[Bf-blender-cvs] [a80977c] master: Fix T49139: Memory leak in UV image editor related to Undo (and possibly Waveform and Vectorscope).

Bastien Montagne noreply at git.blender.org
Fri Aug 26 12:56:50 CEST 2016


Commit: a80977cd213d1a158f4292b9809c85a5b2a7a699
Author: Bastien Montagne
Date:   Fri Aug 26 12:54:49 2016 +0200
Branches: master
https://developer.blender.org/rBa80977cd213d1a158f4292b9809c85a5b2a7a699

Fix T49139: Memory leak in UV image editor related to Undo (and possibly Waveform and Vectorscope).

Assigning NULL to scopes' data pointer in 'non-UI readfile' context was terribly wrong for sure,
if we'd really want to reset them here we should freed them first.

But we can rather just ignore them here, those are purely runtime data managed by image editor,
no need to touch them here.

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

M	source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ded60af..7d65dbc 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6697,10 +6697,13 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
 					 * since it gets initialized later */
 					sima->iuser.scene = NULL;
 					
-					sima->scopes.waveform_1 = NULL;
-					sima->scopes.waveform_2 = NULL;
-					sima->scopes.waveform_3 = NULL;
-					sima->scopes.vecscope = NULL;
+#if 0
+					/* Those are allocated and freed by space code, no need to handle them here. */
+					MEM_SAFE_FREE(sima->scopes.waveform_1);
+					MEM_SAFE_FREE(sima->scopes.waveform_2);
+					MEM_SAFE_FREE(sima->scopes.waveform_3);
+					MEM_SAFE_FREE(sima->scopes.vecscope);
+#endif
 					sima->scopes.ok = 0;
 					
 					/* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data




More information about the Bf-blender-cvs mailing list