[Bf-blender-cvs] [3765653b38f] blender2.8: RNA: Fix crash with select_mode_update.

Germano noreply at git.blender.org
Fri Apr 13 15:48:18 CEST 2018


Commit: 3765653b38f82c1190127f06c868e34c2d017232
Author: Germano
Date:   Fri Apr 13 10:41:44 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB3765653b38f82c1190127f06c868e34c2d017232

RNA: Fix crash with select_mode_update.

`bpy.context.tool_settings.mesh_select_mode = (True, True, True)` was crashing because `wmn->window` was not being passed.

===================================================================

M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index abfbccdcc27..9fb602c81d6 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -911,11 +911,15 @@ static void view3d_main_region_listener(
 				{
 					WM_manipulatormap_tag_refresh(mmap);
 
-					ViewLayer *view_layer = WM_window_get_active_view_layer(wmn->window);
-					Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
-					if (obedit) {
+					ID *ob_data = wmn->reference;
+					if (ob_data == NULL) {
+						BLI_assert(wmn->window); // Use `WM_event_add_notifier` instead of `WM_main_add_notifier`
+						ViewLayer *view_layer = WM_window_get_active_view_layer(wmn->window);
+						ob_data = OBEDIT_FROM_VIEW_LAYER(view_layer)->data;
+					}
+					if (ob_data) {
 						/* TODO(sergey): Notifiers shouldn't really be doing DEG tags. */
-						DEG_id_tag_update((ID *)obedit->data, DEG_TAG_SELECT_UPDATE);
+						DEG_id_tag_update(ob_data, DEG_TAG_SELECT_UPDATE);
 					}
 					ATTR_FALLTHROUGH;
 				}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 568980d6976..3c600f6e367 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1507,8 +1507,10 @@ static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSE
 			me = NULL;
 	}
 
-	WM_main_add_notifier(NC_GEOM | ND_SELECT, me);
-	WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
+	if (me) {
+		DEG_id_tag_update(&me->id, DEG_TAG_SELECT_UPDATE);
+		WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
+	}
 }
 
 static void object_simplify_update(Object *ob)



More information about the Bf-blender-cvs mailing list