mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 05:45:38 +00:00
Qt: Crash fix
This commit is contained in:
parent
9f122ac0f0
commit
34aa419e92
|
@ -29,6 +29,9 @@ LogWindow::LogWindow(bool attach_to_main)
|
||||||
|
|
||||||
LogWindow::~LogWindow()
|
LogWindow::~LogWindow()
|
||||||
{
|
{
|
||||||
|
if (g_log_window == this)
|
||||||
|
g_log_window = nullptr;
|
||||||
|
|
||||||
Log::UnregisterCallback(&LogWindow::logCallback, this);
|
Log::UnregisterCallback(&LogWindow::logCallback, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +42,7 @@ void LogWindow::updateSettings()
|
||||||
const bool curr_enabled = (g_log_window != nullptr);
|
const bool curr_enabled = (g_log_window != nullptr);
|
||||||
if (new_enabled == curr_enabled)
|
if (new_enabled == curr_enabled)
|
||||||
{
|
{
|
||||||
if (g_log_window->m_attached_to_main_window != attach_to_main)
|
if (g_log_window && g_log_window->m_attached_to_main_window != attach_to_main)
|
||||||
{
|
{
|
||||||
g_log_window->m_attached_to_main_window = attach_to_main;
|
g_log_window->m_attached_to_main_window = attach_to_main;
|
||||||
if (attach_to_main)
|
if (attach_to_main)
|
||||||
|
@ -288,6 +291,12 @@ void LogWindow::logCallback(void* pUserParam, const char* channelName, const cha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LogWindow::closeEvent(QCloseEvent* event)
|
||||||
|
{
|
||||||
|
// TODO: Update config.
|
||||||
|
QMainWindow::closeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void LogWindow::appendMessage(const QLatin1StringView& channel, quint32 level, const QString& message)
|
void LogWindow::appendMessage(const QLatin1StringView& channel, quint32 level, const QString& message)
|
||||||
{
|
{
|
||||||
QTextCursor temp_cursor = m_text->textCursor();
|
QTextCursor temp_cursor = m_text->textCursor();
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
|
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
#include <span>
|
|
||||||
#include <QtWidgets/QMainWindow>
|
#include <QtWidgets/QMainWindow>
|
||||||
#include <QtWidgets/QPlainTextEdit>
|
#include <QtWidgets/QPlainTextEdit>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
class LogWindow : public QMainWindow
|
class LogWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,9 @@ private:
|
||||||
static void logCallback(void* pUserParam, const char* channelName, const char* functionName, LOGLEVEL level,
|
static void logCallback(void* pUserParam, const char* channelName, const char* functionName, LOGLEVEL level,
|
||||||
std::string_view message);
|
std::string_view message);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent* event);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onClearTriggered();
|
void onClearTriggered();
|
||||||
void onSaveTriggered();
|
void onSaveTriggered();
|
||||||
|
|
Loading…
Reference in a new issue