fix [#30653] Wrong image at UV/Image Editor window

render results would be displayed on loading new files if the scene names matches, now free render-results so as not to display stale data - also saves some memory.
This commit is contained in:
Campbell Barton 2012-03-26 08:10:12 +00:00
parent 4ade85612c
commit ce4eb57301
3 changed files with 22 additions and 0 deletions

View File

@ -78,6 +78,7 @@
#include "BKE_screen.h"
#include "BKE_sequencer.h"
#include "BKE_sound.h"
#include "RE_pipeline.h"
#include "BLO_undofile.h"
@ -199,6 +200,11 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
recover= (G.fileflags & G_FILE_RECOVER);
/* Free all render results, without this stale data gets displayed after loading files */
if (mode != 'u') {
RE_FreeAllRenderResults();
}
/* Only make filepaths compatible when loading for real (not undo) */
if (mode != 'u') {
clean_paths(bfd->main);

View File

@ -165,6 +165,8 @@ void RE_InitRenderCB(struct Render *re);
void RE_FreeRender (struct Render *re);
/* only called on exit */
void RE_FreeAllRender (void);
/* only call on file load */
void RE_FreeAllRenderResults(void);
/* get results and statistics */
void RE_FreeRenderResult(struct RenderResult *rr);

View File

@ -410,6 +410,20 @@ void RE_FreeAllRender(void)
}
}
/* on file load, free all re */
void RE_FreeAllRenderResults(void)
{
Render *re;
for (re = RenderGlobal.renderlist.first; re; re = re->next) {
render_result_free(re->result);
render_result_free(re->pushedresult);
re->result = NULL;
re->pushedresult = NULL;
}
}
/* ********* initialize state ******** */