Fix userpref.blend using version from startup.blend

Version patching userpref.blend wasn't using the correct version,
causing settings not to be properly updated.

This seems the likely cause of T70196 and similar bugs.
This commit is contained in:
Campbell Barton 2020-10-02 20:11:51 +10:00
parent 34228d138b
commit d1f6c2e7bb
7 changed files with 11 additions and 11 deletions

View File

@ -228,7 +228,7 @@ void BLO_update_defaults_startup_blend(struct Main *bmain, const char *app_templ
void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char *app_template);
/* Version patch user preferences. */
void BLO_version_defaults_userpref_blend(struct Main *bmain, struct UserDef *userdef);
void BLO_version_defaults_userpref_blend(struct UserDef *userdef);
/* Disable unwanted experimental feature settings on startup. */
void BLO_sanitize_experimental_features_userpref_blend(struct UserDef *userdef);

View File

@ -303,10 +303,10 @@ static bool keymap_item_has_invalid_wm_context_data_path(wmKeyMapItem *kmi,
}
/* patching UserDef struct and Themes */
void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
void BLO_version_defaults_userpref_blend(UserDef *userdef)
{
#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(bmain, ver, subver)
/* #UserDef & #Main happen to have the same struct member. */
#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(userdef, ver, subver)
/* the UserDef struct is not corrected with do_versions() .... ugh! */
if (userdef->wheellinescroll == 0) {

View File

@ -1752,7 +1752,7 @@ void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers)
* be used to reinitialize some internal state if user preferences change. */
void UI_init(void);
void UI_init_userdef(struct Main *bmain);
void UI_init_userdef(void);
void UI_reinit_font(void);
void UI_exit(void);

View File

@ -7059,10 +7059,10 @@ void UI_init(void)
}
/* after reading userdef file */
void UI_init_userdef(Main *bmain)
void UI_init_userdef(void)
{
/* fix saved themes */
init_userdef_do_versions(bmain);
init_userdef_do_versions();
uiStyleInit();
BLO_sanitize_experimental_features_userpref_blend(&U);

View File

@ -996,7 +996,7 @@ void icon_draw_rect_input(
float x, float y, int w, int h, float alpha, short event_type, short event_value);
/* resources.c */
void init_userdef_do_versions(struct Main *bmain);
void init_userdef_do_versions(void);
void ui_resources_init(void);
void ui_resources_free(void);

View File

@ -1501,9 +1501,9 @@ void UI_make_axis_color(const uchar src_col[3], uchar dst_col[3], const char axi
}
/* patching UserDef struct and Themes */
void init_userdef_do_versions(Main *bmain)
void init_userdef_do_versions(void)
{
BLO_version_defaults_userpref_blend(bmain, &U);
BLO_version_defaults_userpref_blend(&U);
if (STREQ(U.tempdir, "/")) {
BKE_tempdir_system_init(U.tempdir);

View File

@ -392,7 +392,7 @@ static void wm_window_match_do(bContext *C,
static void wm_init_userdef(Main *bmain)
{
/* versioning is here */
UI_init_userdef(bmain);
UI_init_userdef();
/* needed so loading a file from the command line respects user-pref T26156. */
SET_FLAG_FROM_TEST(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);