Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#30687] ValueError in bpy_struct.callback_add() crashes Blender

Date:
2012-03-26 16:17
Priority:
3
State:
Closed
Submitted by:
Dalai Felinto (dfelinto)
Assigned to:
Campbell Barton (campbellbarton)
Category:
Python
Status:
Closed
Relates to:
Duplicates:
Patches:
 
Summary:
ValueError in bpy_struct.callback_add() crashes Blender
Detailed description
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

Followup

Message
  • Date: 2012-03-26 18:58
  • Sender: Sergey Sharybin
  • 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.
  • Date: 2012-04-20 19:42
  • Sender: Dalai Felinto
  • 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
  • Date: 2012-11-04 16:12
  • Sender: Campbell Barton
  • 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.
 

Attached Files:

Name Date Download
bug.blend 2012-03-26 16:17 Download

Changes:

Field Old Value Date By
status_idOpen2012-11-04 16:12campbellbarton
close_dateNone2012-11-04 16:12campbellbarton
StatusInvestigate2012-11-04 16:12campbellbarton
StatusNew2012-03-26 18:58nazgul
assigned_tonone2012-03-26 18:58nazgul
File Added19885: bug.blend2012-03-26 16:17dfelinto