Fix T56079: crash with startup.blend saved in sculpt/paint modes.
This reverts commit 81a93df6d2, it is not safe
to handle initialization for startup.blend differently. Instead fix the root
issue of the preview icon data structures not being initialized in time.
This commit is contained in:
@@ -59,7 +59,7 @@ typedef struct IconFile {
|
||||
/*
|
||||
* Resizable Icons for Blender
|
||||
*/
|
||||
void UI_icons_init(int first_dyn_id);
|
||||
void UI_icons_init(void);
|
||||
int UI_icon_get_width(int icon_id);
|
||||
int UI_icon_get_height(int icon_id);
|
||||
|
||||
|
||||
@@ -934,9 +934,8 @@ int UI_icon_get_height(int icon_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UI_icons_init(int first_dyn_id)
|
||||
void UI_icons_init()
|
||||
{
|
||||
BKE_icons_init(first_dyn_id);
|
||||
#ifndef WITH_HEADLESS
|
||||
init_iconfile_list(&iconfilelist);
|
||||
init_internal_icons();
|
||||
|
||||
@@ -83,7 +83,7 @@ static struct bThemeState g_theme_state = {
|
||||
|
||||
void ui_resources_init(void)
|
||||
{
|
||||
UI_icons_init(BIFICONID_LAST);
|
||||
UI_icons_init();
|
||||
}
|
||||
|
||||
void ui_resources_free(void)
|
||||
|
||||
@@ -492,13 +492,7 @@ 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);
|
||||
|
||||
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);
|
||||
}
|
||||
wm_event_do_depsgraph(C);
|
||||
|
||||
ED_editors_init(C);
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
#include "ED_undo.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
#include "BLF_api.h"
|
||||
#include "BLT_lang.h"
|
||||
|
||||
@@ -237,6 +238,11 @@ void WM_init(bContext *C, int argc, const char **argv)
|
||||
BLF_init();
|
||||
BLT_lang_init();
|
||||
|
||||
/* Init icons before reading .blend files for preview icons, which can
|
||||
* get triggered by the depsgraph. This is also done in background mode
|
||||
* for scripts that do background processing with preview icons. */
|
||||
BKE_icons_init(BIFICONID_LAST);
|
||||
|
||||
/* reports cant be initialized before the wm,
|
||||
* but keep before file reading, since that may report errors */
|
||||
wm_init_reports(C);
|
||||
@@ -259,13 +265,6 @@ void WM_init(bContext *C, int argc, const char **argv)
|
||||
UI_init();
|
||||
BKE_studiolight_init();
|
||||
}
|
||||
else {
|
||||
/* Note: Currently only inits icons, which we now want in background mode too
|
||||
* (scripts could use those in background processing...).
|
||||
* In case we do more later, we may need to pass a 'background' flag.
|
||||
* Called from 'UI_init' above */
|
||||
BKE_icons_init(1);
|
||||
}
|
||||
|
||||
ED_spacemacros_init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user