Fix regression introduced in ed0f4c3023d8a8b78d04b00177e25a9f5840077d

This commit is contained in:
David Capello 2019-04-01 19:57:53 -03:00
parent 855c7d8ee3
commit f3bb1ecdf1
3 changed files with 7 additions and 6 deletions

View File

@ -105,9 +105,6 @@ class App::CoreModules {
public:
ConfigModule m_configModule;
Preferences m_preferences;
CoreModules() {
initialize_color_spaces();
}
};
class App::LoadLanguage {
@ -231,6 +228,8 @@ void App::initialize(const AppOptions& options)
break;
}
initialize_color_spaces();
// Load modules
m_modules = new Modules(createLogInDesktop, preferences());
m_legacy = new LegacyModules(isGui() ? REQUIRE_INTERFACE: 0);

View File

@ -26,9 +26,12 @@ static Preferences* singleton = nullptr;
// static
Preferences& Preferences::instance()
{
#ifdef _DEBUG
// Preferences can be used only from the main UI thread. In other
// case access to std::map<> could crash the program.
ui::assert_ui_thread();
if (ui::UISystem::instance())
ui::assert_ui_thread();
#endif
ASSERT(singleton);
return *singleton;

View File

@ -362,8 +362,7 @@ void execute_from_ui_thread(std::function<void()>&& f)
bool is_ui_thread()
{
return (!main_gui_thread ||
main_gui_thread == base::this_thread::native_handle());
return (main_gui_thread == base::this_thread::native_handle());
}
#ifdef _DEBUG