Fix #22086 and #22125: crashes due to editmode being set on load/undo, fixes

are simple enough, though may still revert this feature if it turns out there
are more problems.
This commit is contained in:
Brecht Van Lommel
2010-04-26 10:12:03 +00:00
parent 2785bc1aef
commit b757e5c944
2 changed files with 7 additions and 0 deletions

View File

@@ -3897,6 +3897,11 @@ static void direct_link_object(FileData *fd, Object *ob)
/* weak weak... this was only meant as draw flag, now is used in give_base too */
ob->flag &= ~OB_FROMGROUP;
/* loading saved files with editmode enabled works, but for undo we like
to stay in object mode during undo presses so keep editmode disabled */
if(fd->memfile)
ob->mode &= ~(OB_MODE_EDIT|OB_MODE_PARTICLE_EDIT);
ob->disp.first=ob->disp.last= NULL;

View File

@@ -369,6 +369,8 @@ int WM_read_homefile(bContext *C, wmOperator *op)
// undo_editmode_clear();
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
ED_editors_init(C);
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
CTX_wm_window_set(C, NULL); /* exits queues */