Calling destructor of notifications manager and hint database

Ensures to translate hints after change of language
This commit is contained in:
David Kocik 2021-09-01 17:58:55 +02:00
parent 5f7a4982f6
commit 42f4de94df
5 changed files with 17 additions and 0 deletions

View file

@ -242,6 +242,13 @@ HintDatabase::~HintDatabase()
write_used_binary(m_used_ids);
}
}
void HintDatabase::uninit()
{
if (m_initialized) {
write_used_binary(m_used_ids);
}
m_initialized = false;
}
void HintDatabase::init()
{
load_hints_from_file(std::move(boost::filesystem::path(resources_dir()) / "data" / "hints.ini"));

View file

@ -47,6 +47,9 @@ public:
return 0;
return m_loaded_hints.size();
}
// resets m_initiailized to false and writes used if was initialized
// used when reloading in runtime - like change language
void uninit();
private:
void init();
void load_hints_from_file(const boost::filesystem::path& path);

View file

@ -1107,6 +1107,10 @@ NotificationManager::NotificationManager(wxEvtHandler* evt_handler) :
m_evt_handler(evt_handler)
{
}
NotificationManager::~NotificationManager()
{
HintDatabase::get_instance().uninit();
}
void NotificationManager::push_notification(const NotificationType type, int timestamp)
{
auto it = std::find_if(std::begin(basic_notifications), std::end(basic_notifications),

View file

@ -121,6 +121,7 @@ public:
};
NotificationManager(wxEvtHandler* evt_handler);
~NotificationManager();
// Push a prefabricated notification from basic_notifications (see the table at the end of this file).
void push_notification(const NotificationType type, int timestamp = 0);

View file

@ -2073,6 +2073,8 @@ Plater::priv::~priv()
{
if (config != nullptr)
delete config;
if (notification_manager != nullptr)
delete notification_manager;
}
void Plater::priv::update(unsigned int flags)