[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32149] trunk/blender/source/blender/ editors: bugfix [#24009] Crash when switching area types and performing ops

Campbell Barton ideasman42 at gmail.com
Mon Sep 27 12:44:46 CEST 2010


Revision: 32149
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32149
Author:   campbellbarton
Date:     2010-09-27 12:44:46 +0200 (Mon, 27 Sep 2010)

Log Message:
-----------
bugfix [#24009] Crash when switching area types and performing ops
tested every view3d operator to make sure none crash.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_screen.h
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c
    trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/editors/include/ED_screen.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen.h	2010-09-27 10:36:02 UTC (rev 32148)
+++ trunk/blender/source/blender/editors/include/ED_screen.h	2010-09-27 10:44:46 UTC (rev 32149)
@@ -125,6 +125,7 @@
 int		ED_operator_scene_editable(struct bContext *C);
 
 int		ED_operator_view3d_active(struct bContext *C);
+int		ED_operator_region_view3d_active(struct bContext *C);
 int		ED_operator_timeline_active(struct bContext *C);
 int		ED_operator_outliner_active(struct bContext *C);
 int		ED_operator_file_active(struct bContext *C);

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2010-09-27 10:36:02 UTC (rev 32148)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2010-09-27 10:44:46 UTC (rev 32149)
@@ -129,6 +129,11 @@
 	return ed_spacetype_test(C, SPACE_VIEW3D);
 }
 
+int ED_operator_region_view3d_active(bContext *C)
+{
+	return CTX_wm_region_view3d(C) != NULL;
+}
+
 int ED_operator_timeline_active(bContext *C)
 {
 	return ed_spacetype_test(C, SPACE_TIME);

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2010-09-27 10:36:02 UTC (rev 32148)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c	2010-09-27 10:44:46 UTC (rev 32149)
@@ -783,7 +783,7 @@
 
 static int view3d_rotate_poll(bContext *C)
 {
-	if (!ED_operator_view3d_active(C)) {
+	if (!ED_operator_region_view3d_active(C)) {
 		return 0;
 	} else {
 		RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -1264,7 +1264,7 @@
 	ot->invoke= viewzoom_invoke;
 	ot->exec= viewzoom_exec;
 	ot->modal= viewzoom_modal;
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 
 	/* flags */
 	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -1522,7 +1522,7 @@
 
 	/* api callbacks */
 	ot->exec= viewselected_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 
 	/* flags */
 	ot->flag= 0;
@@ -1822,7 +1822,7 @@
 	ot->exec= view3d_zoom_border_exec;
 	ot->modal= WM_border_select_modal;
 
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 
 	/* flags */
 	ot->flag= 0;
@@ -2044,7 +2044,7 @@
 
 	/* api callbacks */
 	ot->exec= viewnumpad_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 
 	/* flags */
 	ot->flag= 0;
@@ -2162,7 +2162,7 @@
 
 	/* api callbacks */
 	ot->exec= viewpan_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 
 	/* flags */
 	ot->flag= 0;
@@ -2194,7 +2194,7 @@
 
 	/* api callbacks */
 	ot->exec= viewpersportho_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 
 	/* flags */
 	ot->flag= 0;
@@ -2413,7 +2413,7 @@
 	ot->exec= view3d_clipping_exec;
 	ot->modal= WM_border_select_modal;
 
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 
 	/* flags */
 	ot->flag= 0;

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2010-09-27 10:36:02 UTC (rev 32148)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2010-09-27 10:44:46 UTC (rev 32149)
@@ -215,7 +215,7 @@
 {
 	Object *ob = CTX_data_active_object(C);
 	
-	if (!ED_operator_view3d_active(C))
+	if (!ED_operator_region_view3d_active(C))
 		return 0;
 	
 	if (!CTX_data_edit_object(C))

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_snap.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_snap.c	2010-09-27 10:36:02 UTC (rev 32148)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_snap.c	2010-09-27 10:44:46 UTC (rev 32149)
@@ -569,7 +569,7 @@
 	
 	/* api callbacks */
 	ot->exec= snap_sel_to_grid;
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 	
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -732,7 +732,7 @@
 	
 	/* api callbacks */
 	ot->exec= snap_curs_to_grid;
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 	
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-09-27 10:36:02 UTC (rev 32148)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2010-09-27 10:44:46 UTC (rev 32149)
@@ -472,7 +472,7 @@
 	
 	/* api callbacks */
 	ot->exec= view3d_setobjectascamera_exec;	
-	ot->poll= ED_operator_view3d_active;
+	ot->poll= ED_operator_region_view3d_active;
 	
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;





More information about the Bf-blender-cvs mailing list