Made an attempt to fix a crash due to undo. An undo invalidated

some Freestyle-related pointers, which led to a crash when the
rendering was initiated or the Freestyle panel (in the Scene buttons)
was redrawn.
This commit is contained in:
Tamito Kajiyama 2009-08-25 23:46:00 +00:00
parent ed4669df0c
commit 0a4d70f4d0
5 changed files with 11 additions and 5 deletions

@ -27,7 +27,7 @@ extern "C" {
// Rendering
void FRS_initialize();
void FRS_add_Freestyle(Render* re);
void FRS_add_Freestyle(struct Render* re);
void FRS_exit();
// Panel configuration

@ -108,6 +108,8 @@
#include "BPY_extern.h"
#endif
#include "FRS_freestyle.h"
#include "mydevice.h"
#include "blendef.h"
@ -1380,6 +1382,7 @@ void screenmain(void)
else if (event==LOAD_FILE) {
BIF_read_file(ext_load_str);
sound_initialize_sounds();
FRS_initialize();
}
#ifndef DISABLE_PYTHON
else if ((event==ONLOAD_SCRIPT) && BPY_has_onload_script()) {

@ -189,6 +189,8 @@
#include "GPU_extensions.h"
#include "GPU_draw.h"
#include "FRS_freestyle.h"
#include "BLO_sys_types.h" // for intptr_t support
/* maybe we need this defined somewhere else */
@ -1086,6 +1088,7 @@ void BIF_undo(void)
#endif
BKE_undo_step(1);
sound_initialize_sounds();
FRS_initialize();
}
}
}
@ -1109,6 +1112,7 @@ void BIF_redo(void)
if(U.uiflag & USER_GLOBALUNDO) {
BKE_undo_step(-1);
sound_initialize_sounds();
FRS_initialize();
}
}
}
@ -1132,6 +1136,7 @@ void BIF_undo_menu(void)
if(event>0) {
BKE_undo_number(event);
sound_initialize_sounds();
FRS_initialize();
}
}
}

@ -598,6 +598,7 @@ void BIF_read_file(char *name)
mainwindow_set_filename_to_title(G.main->name);
countall();
sound_initialize_sounds();
FRS_initialize();
winqueue_break= 1; /* leave queues everywhere */
@ -605,8 +606,6 @@ void BIF_read_file(char *name)
if (retval!=0) G.relbase_valid = 1;
FRS_initialize();
undo_editmode_clear();
undo_imagepaint_clear();
BKE_reset_undo();

@ -817,13 +817,12 @@ int main(int argc, char **argv)
if (G.background) {
int retval = BKE_read_file(filename, NULL);
sound_initialize_sounds();
FRS_initialize();
/*we successfully loaded a blend file, get sure that
pointcache works */
if (retval!=0) G.relbase_valid = 1;
FRS_initialize();
/* happens for the UI on file reading too */
BKE_reset_undo();
BKE_write_undo("original"); /* save current state */