[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56244] trunk/blender/source/blender/ editors/space_view3d/view3d_ruler.c: fix [#34894] Ruler/Protractor: While it's active, one can open the file browser for file saving + Crash
Campbell Barton
ideasman42 at gmail.com
Tue Apr 23 17:42:45 CEST 2013
Revision: 56244
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56244
Author: campbellbarton
Date: 2013-04-23 15:42:41 +0000 (Tue, 23 Apr 2013)
Log Message:
-----------
fix [#34894] Ruler/Protractor: While it's active, one can open the file browser for file saving + Crash
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/view3d_ruler.c
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_ruler.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_ruler.c 2013-04-23 15:29:39 UTC (rev 56243)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_ruler.c 2013-04-23 15:42:41 UTC (rev 56244)
@@ -158,7 +158,9 @@
int state;
float drag_start_co[3];
- /* --- */
+ /* wm state */
+ wmWindow *win;
+ ScrArea *sa;
ARegion *ar;
void *draw_handle_pixel;
} RulerInfo;
@@ -740,6 +742,8 @@
op->customdata = ruler_info;
+ ruler_info->win = win;
+ ruler_info->sa = sa;
ruler_info->ar = ar;
ruler_info->draw_handle_pixel = ED_region_draw_cb_activate(ar->type, ruler_info_draw_pixel,
ruler_info, REGION_DRAW_POST_PIXEL);
@@ -768,10 +772,15 @@
bool do_draw = false;
int exit_code = OPERATOR_RUNNING_MODAL;
RulerInfo *ruler_info = op->customdata;
+ ScrArea *sa = ruler_info->sa;
ARegion *ar = ruler_info->ar;
RegionView3D *rv3d = ar->regiondata;
- (void)C;
+ /* its possible to change spaces while running the operator [#34894] */
+ if (UNLIKELY(ar != CTX_wm_region(C))) {
+ exit_code = OPERATOR_FINISHED;
+ goto exit;
+ }
switch (event->type) {
case LEFTMOUSE:
@@ -943,20 +952,16 @@
}
if (do_draw) {
- ScrArea *sa = CTX_wm_area(C);
-
view3d_ruler_header_update(sa);
/* all 3d views draw rulers */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
+exit:
if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED)) {
- wmWindow *win = CTX_wm_window(C);
- ScrArea *sa = CTX_wm_area(C);
+ WM_cursor_restore(ruler_info->win);
- WM_cursor_restore(win);
-
view3d_ruler_end(C, ruler_info);
view3d_ruler_free(ruler_info);
op->customdata = NULL;
More information about the Bf-blender-cvs
mailing list