Merge pull request #4231 from ligfx/fix_sigabrt_when_quitting_from_dock

Move LogWindow/LogConfigWindow destructor logic -> OnClose
This commit is contained in:
Mat M 2016-10-02 16:33:18 -04:00 committed by GitHub
commit 10cccd9228
4 changed files with 14 additions and 11 deletions

View File

@ -25,13 +25,14 @@ LogConfigWindow::LogConfigWindow(wxWindow* parent, wxWindowID id)
_("Log Configuration")),
enableAll(true)
{
Bind(wxEVT_CLOSE_WINDOW, &LogConfigWindow::OnClose, this);
SetMinSize(wxSize(100, 100));
m_LogManager = LogManager::GetInstance();
CreateGUIControls();
LoadSettings();
}
LogConfigWindow::~LogConfigWindow()
void LogConfigWindow::OnClose(wxCloseEvent& event)
{
SaveSettings();
}

View File

@ -15,7 +15,6 @@ class LogConfigWindow : public wxPanel
{
public:
LogConfigWindow(wxWindow* parent, wxWindowID id = wxID_ANY);
~LogConfigWindow();
void SaveSettings();
void LoadSettings();
@ -32,6 +31,7 @@ private:
void CreateGUIControls();
void OnVerbosityChange(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
void OnWriteFileChecked(wxCommandEvent& event);
void OnWriteConsoleChecked(wxCommandEvent& event);
void OnWriteWindowChecked(wxCommandEvent& event);

View File

@ -149,18 +149,20 @@ void CLogWindow::CreateGUIControls()
m_cmdline->SetFocus();
}
CLogWindow::~CLogWindow()
{
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, LogListener::LOG_WINDOW_LISTENER);
}
}
void CLogWindow::OnClose(wxCloseEvent& event)
{
SaveSettings();
event.Skip();
RemoveAllListeners();
}
void CLogWindow::RemoveAllListeners()
{
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
m_LogManager->RemoveListener(static_cast<LogTypes::LOG_TYPE>(i),
LogListener::LOG_WINDOW_LISTENER);
}
}
void CLogWindow::SaveSettings()

View File

@ -28,7 +28,6 @@ public:
CLogWindow(CFrame* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL,
const wxString& name = _("Log"));
~CLogWindow();
void SaveSettings();
void Log(LogTypes::LOG_LEVELS, const char* text) override;
@ -63,5 +62,6 @@ private:
void OnWrapLineCheck(wxCommandEvent& event);
void OnClear(wxCommandEvent& event);
void OnLogTimer(wxTimerEvent& WXUNUSED(event));
void RemoveAllListeners();
void UpdateLog();
};