diff options
author | Ton Roosendaal <ton@blender.org> | 2011-03-31 19:26:51 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-03-31 19:26:51 +0400 |
commit | 6e14661ad06835a70c7457de50b87da333690f40 (patch) | |
tree | b525de42316719e49b9ddbbf99382892246448fb /source/blender/editors/gpencil/gpencil_paint.c | |
parent | 76d7a3562c448d431def367e2e444696efb6c97e (diff) |
Bugfix #26651
If greasepencil became active, making Blender area full or restore
screen from full, the greasepencil handler was still running, using
outdated area pointer. This crashed Blender.
Now greasepencil modal() ends on the case its own stored area does
not exist anymore.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 2f2f9c37bdc..17e7c0c221b 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1594,6 +1594,18 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } +/* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */ +static int gpencil_area_exists(bContext *C, ScrArea *satest) +{ + bScreen *sc= CTX_wm_screen(C); + ScrArea *sa; + + for(sa= sc->areabase.first; sa; sa= sa->next) + if(sa==satest) + return 1; + return 0; +} + /* events handling during interactive drawing part of operator */ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) { @@ -1659,6 +1671,8 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) } } + + /* handle mode-specific events */ if (p->status == GP_STATUS_PAINTING) { /* handle painting mouse-movements? */ @@ -1705,8 +1719,12 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) } } - /* update status indicators - cursor, header, etc. */ - gpencil_draw_status_indicators(p); + /* gpencil modal operator stores area, which can be removed while using it (like fullscreen) */ + if(0==gpencil_area_exists(C, p->sa)) + estate= OPERATOR_CANCELLED; + else + /* update status indicators - cursor, header, etc. */ + gpencil_draw_status_indicators(p); /* process last operations before exiting */ switch (estate) { |