fix crash when polling image sample outside image space.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 1 Aug 2012 14:29:24 +0000 (14:29 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 1 Aug 2012 14:29:24 +0000 (14:29 +0000)
also remove historic comment which isnt helpful.

intern/guardedalloc/intern/mallocn.c
source/blender/editors/space_image/image_ops.c

index ffda6829ee08764ae473576deb2e1a500b3884e2..c4902e6aa5a6f8a6e197be9cc96d399eff0ea0e3 100644 (file)
@@ -644,7 +644,7 @@ void MEM_printmemlist_pydict(void)
        MEM_printmemlist_internal(1);
 }
 
-short MEM_freeN(void *vmemh)        /* anders compileertie niet meer */
+short MEM_freeN(void *vmemh)
 {
        short error = 0;
        MemTail *memt;
index 8376a0bf0d34ce00ea67817832881fdc080a8b4a..aa44caac0afa382dcac4e8095783f8d4823cdd54 100644 (file)
@@ -203,21 +203,27 @@ int space_image_main_area_not_uv_brush_poll(bContext *C)
        return 0;
 }
 
-static int space_image_image_sample_poll(bContext *C)
+static int image_sample_poll(bContext *C)
 {
        SpaceImage *sima = CTX_wm_space_image(C);
-       Object *obedit = CTX_data_edit_object(C);
-       ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
+       if (sima) {
+               Scene *scene = CTX_data_scene(C);
+               Object *obedit = CTX_data_edit_object(C);
+               ToolSettings *toolsettings = scene->toolsettings;
+
+               if (obedit) {
+                       if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt))
+                               return FALSE;
+               }
+               else if (sima->mode != SI_MODE_VIEW) {
+                       return FALSE;
+               }
 
-       if (obedit) {
-               if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt))
-                       return 0;
+               return space_image_main_area_poll(C);
        }
-       else if (sima->mode != SI_MODE_VIEW) {
-               return 0;
+       else {
+               return FALSE;
        }
-
-       return space_image_main_area_poll(C);
 }
 /********************** view pan operator *********************/
 
@@ -2113,7 +2119,7 @@ void IMAGE_OT_sample(wmOperatorType *ot)
        ot->invoke = image_sample_invoke;
        ot->modal = image_sample_modal;
        ot->cancel = image_sample_cancel;
-       ot->poll = space_image_image_sample_poll;
+       ot->poll = image_sample_poll;
 
        /* flags */
        ot->flag = OPTYPE_BLOCKING;