Fix crash when startup file has an image in it

This fixes an issue introduced in d192d72312.
When starting up, the UI hasn't been fully initialised yet, and calling
wm_event_do_depsgraph() can trigger icon updates when the startup file
contains an image, causing a segfault due to a not-yet-initialised ghash
for the icons.
This commit is contained in:
Sybren A. Stüvel 2018-07-06 13:52:35 +02:00
parent ccef83b2fb
commit 81a93df6d2
1 changed files with 7 additions and 1 deletions

View File

@ -484,7 +484,13 @@ static void wm_file_read_post(bContext *C, const bool is_startup_file, const boo
Main *bmain = CTX_data_main(C);
DEG_on_visible_update(bmain, true);
wm_event_do_depsgraph(C);
if (!is_startup_file) {
/* When starting up, the UI hasn't been fully initialised yet, and
* this call can trigger icon updates, causing a segfault due to a
* not-yet-initialised ghash for the icons. */
wm_event_do_depsgraph(C);
}
ED_editors_init(C);