Cycles: fix crash in image assign/remove in image editor.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 10 Nov 2011 13:39:25 +0000 (13:39 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 10 Nov 2011 13:39:25 +0000 (13:39 +0000)
source/blender/editors/include/ED_image.h
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/makesrna/intern/rna_space.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 4e8aadecfc7d08fcf54f8f3d08d93eb5c33c75a1..27c61e98e21deb8965889fd795ac81dac1d03c91 100644 (file)
@@ -41,7 +41,7 @@ struct wmWindowManager;
 
 /* space_image.c, exported for transform */
 struct Image *ED_space_image(struct SpaceImage *sima);
-void ED_space_image_set(struct bContext *C, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima);
+void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima);
 
 struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r);
 void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock);
index 7121e4872eb2eecedab1281df4f42991b216bf1e..77c92b2d9c33c4910b9e30734b15e03d69ee81d1 100644 (file)
@@ -804,7 +804,7 @@ static int image_open_exec(bContext *C, wmOperator *op)
                RNA_property_update(C, &pprop->ptr, pprop->prop);
        }
        else if(sima) {
-               ED_space_image_set(C, sima, scene, obedit, ima);
+               ED_space_image_set(sima, scene, obedit, ima);
                iuser= &sima->iuser;
        }
        else {
@@ -1420,7 +1420,7 @@ static int image_new_exec(bContext *C, wmOperator *op)
                RNA_property_update(C, &ptr, prop);
        }
        else if(sima)
-               ED_space_image_set(C, sima, scene, obedit, ima);
+               ED_space_image_set(sima, scene, obedit, ima);
 
        // XXX other users?
        BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_USER_NEW_IMAGE);
index c29553a9c875ff2dfde47b6e1205e7f265b61c8c..99c190cd2dd804bd951dc24b26927520cb0ee0be 100644 (file)
@@ -82,9 +82,10 @@ Image *ED_space_image(SpaceImage *sima)
 }
 
 /* called to assign images to UV faces */
-void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obedit, Image *ima)
+void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *ima)
 {
-       ED_uvedit_assign_image(CTX_data_main(C), scene, obedit, ima, sima->image);
+       /* context may be NULL, so use global */
+       ED_uvedit_assign_image(G.main, scene, obedit, ima, sima->image);
        
        /* change the space ima after because uvedit_face_visible uses the space ima
         * to check if the face is displayed in UV-localview */
@@ -99,13 +100,10 @@ void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obe
        if(sima->image && sima->image->id.us==0)
                sima->image->id.us= 1;
        
-       if(C) {
-               if(obedit)
-                       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-               
-               ED_area_tag_redraw(CTX_wm_area(C));
-               
-       }
+       if(obedit)
+               WM_main_add_notifier(NC_GEOM|ND_DATA, obedit->data);
+
+       WM_main_add_notifier(NC_SPACE|ND_SPACE_IMAGE, NULL);
 }
 
 ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r)
index db4db299f92a3e5efe5c3af185d01076a57a7c19..31f3d59e64321181d15d99737e9d4bebccd60aa4 100644 (file)
@@ -514,7 +514,7 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
        SpaceImage *sima= (SpaceImage*)(ptr->data);
        bScreen *sc= (bScreen*)ptr->id.data;
 
-       ED_space_image_set(NULL, sima, sc->scene, sc->scene->obedit, (Image*)value.data);
+       ED_space_image_set(sima, sc->scene, sc->scene->obedit, (Image*)value.data);
 }
 
 static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr,
index 6af05dd13618fa3fb29e721d92ca290fc6b97bff..48dcf8a1c7f029c06d52ea2334283eb8f927841d 100644 (file)
@@ -47,6 +47,7 @@ struct CSG_VertexIteratorDescriptor;
 struct ColorBand;
 struct CurveMapping;
 struct Curve;
+struct DerivedMesh;
 struct EditBone;
 struct EditFace;
 struct EditMesh;
@@ -77,6 +78,7 @@ struct RenderEngine;
 struct RenderEngineType;
 struct RenderLayer;
 struct RenderResult;
+struct Scene;
 struct ScrArea;
 struct SculptSession;
 struct ShadeInput;
@@ -198,7 +200,7 @@ int ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit){r
 int ED_space_image_show_render(struct SpaceImage *sima){return 0;}
 int ED_space_image_show_paint(struct SpaceImage *sima){return 0;}
 void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings){}
-void ED_space_image_set(struct bContext *C, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima){}
+void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima){}
 struct ImBuf *ED_space_image_buffer(struct SpaceImage *sima){return (struct ImBuf *) NULL;}
 void ED_screen_set_scene(struct bContext *C, struct Scene *scene){}
 void ED_space_clip_set(struct bContext *C, struct SpaceClip *sc, struct MovieClip *clip){}