Fix missing render result release when alt-wheeling render pass menu
authorSergey Sharybin <sergey.vfx@gmail.com>
Sun, 24 Jan 2016 20:23:02 +0000 (01:23 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 24 Jan 2016 20:25:09 +0000 (01:25 +0500)
source/blender/editors/space_image/image_buttons.c

index 4c124db359ef5fbcf30f830e9dcd12020f4e4b1c..f22152651e240b50a57b7417e24cd21259c6c3ef 100644 (file)
@@ -597,6 +597,7 @@ static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt
 
        rr = BKE_image_acquire_renderresult(scene, image);
        if (UNLIKELY(rr == NULL)) {
+               BKE_image_release_renderresult(scene, image);
                return false;
        }
 
@@ -606,11 +607,13 @@ static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt
 
        rl = BLI_findlink(&rr->layers, layer);
        if (rl == NULL) {
+               BKE_image_release_renderresult(scene, image);
                return false;
        }
 
        rpass = BLI_findlink(&rl->passes, iuser->pass);
        if (rpass == NULL) {
+               BKE_image_release_renderresult(scene, image);
                return false;
        }
 
@@ -631,8 +634,10 @@ static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt
                RenderPass *rp;
                int rp_index = 0;
 
-               if (iuser->pass == 0)
+               if (iuser->pass == 0) {
+                       BKE_image_release_renderresult(scene, image);
                        return false;
+               }
 
                for (rp = rl->passes.first; rp; rp = rp->next, rp_index++) {
                        if (rp->passtype == rpass->passtype) {
@@ -646,6 +651,8 @@ static bool ui_imageuser_pass_menu_step(bContext *C, int direction, void *rnd_pt
                BLI_assert(0);
        }
 
+       BKE_image_release_renderresult(scene, image);
+
        if (changed) {
                BKE_image_multilayer_index(rr, iuser);
                WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);