LogManager: Stop using manual memory management

This fixes a memory leak that would occur when the Android frontend
calls LogManager::Init more than once in order to reload settings.

Note that the log window listener is now owned by LogManager instead of
by the frontend, making it consistent with the other log listeners.
This commit is contained in:
JosJuice 2025-05-02 13:56:44 +02:00
commit c8be819711
4 changed files with 39 additions and 24 deletions

View file

@ -52,15 +52,16 @@ LogWidget::LogWidget(QWidget* parent) : QDockWidget(parent), m_timer(new QTimer(
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &LogWidget::UpdateFont);
Common::Log::LogManager::GetInstance()->RegisterListener(LogListener::LOG_WINDOW_LISTENER, this);
Common::Log::LogManager::GetInstance()->RegisterListener(
Common::Log::LogListener::LOG_WINDOW_LISTENER, std::make_unique<LogListenerImpl>(this));
}
LogWidget::~LogWidget()
{
SaveSettings();
Common::Log::LogManager::GetInstance()->RegisterListener(LogListener::LOG_WINDOW_LISTENER,
nullptr);
Common::Log::LogManager::GetInstance()->RegisterListener(
Common::Log::LogListener::LOG_WINDOW_LISTENER, nullptr);
}
void LogWidget::UpdateLog()