ValueError in bpy_struct.callback_add() crashes Blender #30687

Closed
opened 2012-03-26 16:17:36 +02:00 by Dalai Felinto · 5 comments

%%%See the attached file (run the script and call the 'Crash' opertaor).
But basically passing the wrong value for callback_add() is crashing Blender.

e.g. context.region.callback_add(draw_callback_px, (self, context), 'BUGBUGBUGBUG')
ValueError: bpy_struct.callback_add(): 'BUGBUGBUGBUG' not found in ('POST_PIXEL', 'POST_VIEW', 'PRE_VIEW')


Program received signal SIGSEGV, Segmentation fault.
0x00000000012c74f0 in wm_event_modalkeymap (C=0x3be8a18, op=0x58610a0,

  event=0x5665b68)
  at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1331

1331 if (op->type->modalkeymap) {

0 0x00000000012c74f0 in wm_event_modalkeymap (C=0x3be8a18, op=0x58610a0,

  event=0x5665b68)
  at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1331

1 0x00000000012c7642 in wm_handler_operator_call (C=0x3be8a18,

  handlers=0x58698a8, handler=0x56a7da8, event=0x5665b68, properties=0x0)
  at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1364

2 0x00000000012c826c in wm_handlers_do (C=0x3be8a18, event=0x5665b68,

  handlers=0x58698a8)
  at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1723

3 0x00000000012c8de2 in wm_event_do_handlers (C=0x3be8a18)

  at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1983

4 0x00000000012c2312 in WM_main (C=0x3be8a18)

  at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm.c:366

5 0x00000000012c18a0 in main (argc=1, argv=0x7fffffffe1e8)

  at /home/dfelinto/blender/bf/source/creator/creator.c:1319

Blender svn (> 2.62) linux%%%

%%%See the attached file (run the script and call the 'Crash' opertaor). But basically passing the wrong value for callback_add() is crashing Blender. e.g. context.region.callback_add(draw_callback_px, (self, context), 'BUGBUGBUGBUG') ValueError: bpy_struct.callback_add(): 'BUGBUGBUGBUG' not found in ('POST_PIXEL', 'POST_VIEW', 'PRE_VIEW') **** Program received signal SIGSEGV, Segmentation fault. 0x00000000012c74f0 in wm_event_modalkeymap (C=0x3be8a18, op=0x58610a0, ``` event=0x5665b68) at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1331 ``` 1331 if (op->type->modalkeymap) { # 0 0x00000000012c74f0 in wm_event_modalkeymap (C=0x3be8a18, op=0x58610a0, ``` event=0x5665b68) at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1331 ``` # 1 0x00000000012c7642 in wm_handler_operator_call (C=0x3be8a18, ``` handlers=0x58698a8, handler=0x56a7da8, event=0x5665b68, properties=0x0) at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1364 ``` # 2 0x00000000012c826c in wm_handlers_do (C=0x3be8a18, event=0x5665b68, ``` handlers=0x58698a8) at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1723 ``` # 3 0x00000000012c8de2 in wm_event_do_handlers (C=0x3be8a18) ``` at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm_event_system.c:1983 ``` # 4 0x00000000012c2312 in WM_main (C=0x3be8a18) ``` at /home/dfelinto/blender/bf/source/blender/windowmanager/intern/wm.c:366 ``` # 5 0x00000000012c18a0 in main (argc=1, argv=0x7fffffffe1e8) ``` at /home/dfelinto/blender/bf/source/creator/creator.c:1319 ``` **** Blender svn (> 2.62) linux%%%
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'

%%%You're using API in a wrong way: last argument of callback_add is supposed to be in ('POST_PIXEL', 'POST_VIEW', 'PRE_VIEW'). Your code throws an exception here which ends up partially initialized modal operator which confuses operator system at all.
Campbell, can you check if it can be easily fixed? But personally do't actually consider this is a bug, so if it'll lead to some hackinsh ways to support nicer behavior here prefer not to change this.%%%

%%%You're using API in a wrong way: last argument of callback_add is supposed to be in ('POST_PIXEL', 'POST_VIEW', 'PRE_VIEW'). Your code throws an exception here which ends up partially initialized modal operator which confuses operator system at all. Campbell, can you check if it can be easily fixed? But personally do't actually consider this is a bug, so if it'll lead to some hackinsh ways to support nicer behavior here prefer not to change this.%%%
Author
Owner

%%%I know the last argument is supposed to be one of them. But segfault is always a bad deal.
In fact I have often faced that almost any problem in the callback function will segfault blender%%%

%%%I know the last argument is supposed to be one of them. But segfault is always a bad deal. In fact I have often faced that almost any problem in the callback function will segfault blender%%%

%%%I've modified our examples so modal_handler_add is always called just before returning, this way avoids possability that self is freed.

crashing is bad but this is low level window api.
closing.%%%

%%%I've modified our examples so `modal_handler_add` is always called _just_ before returning, this way avoids possability that `self` is freed. crashing is bad but this is low level window api. closing.%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#30687
No description provided.