Qt: Fix closing log window via taskbar

This commit is contained in:
Stenzek 2024-03-21 02:00:44 +10:00
parent bcc7ab71cb
commit 2be8287edf
No known key found for this signature in database
2 changed files with 9 additions and 0 deletions

View File

@ -59,6 +59,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;
@ -70,6 +71,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;
@ -306,6 +308,12 @@ void LogWindow::logCallback(void* pUserParam, const char* channelName, const cha
void LogWindow::closeEvent(QCloseEvent* event) void LogWindow::closeEvent(QCloseEvent* event)
{ {
if (!m_destroying)
{
event->ignore();
return;
}
Log::UnregisterCallback(&LogWindow::logCallback, this); Log::UnregisterCallback(&LogWindow::logCallback, this);
saveSize(); saveSize();

View File

@ -55,6 +55,7 @@ private:
std::span<const char*> m_filter_names; std::span<const char*> m_filter_names;
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;