Qt: Fix closing log window via taskbar

This commit is contained in:
JordanTheToaster 2024-03-20 16:36:52 +00:00 committed by Connor McLaughlin
parent 23d98e9352
commit 3f4d9fd23c
2 changed files with 8 additions and 0 deletions

View File

@ -76,6 +76,7 @@ void LogWindow::updateSettings()
} }
else if (g_log_window) else if (g_log_window)
{ {
g_log_window->m_destroying = true;
g_log_window->close(); g_log_window->close();
g_log_window->deleteLater(); g_log_window->deleteLater();
g_log_window = nullptr; g_log_window = nullptr;
@ -88,6 +89,7 @@ void LogWindow::destroy()
if (!g_log_window) if (!g_log_window)
return; return;
g_log_window->m_destroying = true;
g_log_window->close(); g_log_window->close();
g_log_window->deleteLater(); g_log_window->deleteLater();
g_log_window = nullptr; g_log_window = nullptr;
@ -248,6 +250,11 @@ void LogWindow::logCallback(LOGLEVEL level, ConsoleColors color, std::string_vie
void LogWindow::closeEvent(QCloseEvent* event) void LogWindow::closeEvent(QCloseEvent* event)
{ {
if (!m_destroying)
{
event->ignore();
return;
}
Log::SetHostOutputLevel(LOGLEVEL_NONE, nullptr); Log::SetHostOutputLevel(LOGLEVEL_NONE, nullptr);
saveSize(); saveSize();

View File

@ -48,6 +48,7 @@ private:
QMenu* m_level_menu; QMenu* m_level_menu;
bool m_attached_to_main_window = true; bool m_attached_to_main_window = true;
bool m_destroying = false;
}; };
extern LogWindow* g_log_window; extern LogWindow* g_log_window;