Delay restoring the auto-saved state
Restoring auto-saved state triggers source/destination sync which breaks in the early stage when wxZRColaComposerPanel is still in its constructor. The sync uses the application's m_mainWnd to get its settings, but the application doesn't have the m_mainWnd set yet. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
980e5c6b2c
commit
fc7f9da219
@ -174,6 +174,7 @@ bool ZRColaApp::OnInit()
|
||||
wxSocketBase::Initialize();
|
||||
|
||||
m_mainWnd = new wxZRColaFrame();
|
||||
m_mainWnd->m_panel->RestoreFromStateFile();
|
||||
m_mainWnd->Show();
|
||||
|
||||
return true;
|
||||
|
@ -45,7 +45,22 @@ wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
|
||||
m_destination->SetMargins(FromDIP(wxPoint(5, 2)));
|
||||
|
||||
m_source->PushEventHandler(&m_keyhandler);
|
||||
}
|
||||
|
||||
|
||||
wxZRColaComposerPanel::~wxZRColaComposerPanel()
|
||||
{
|
||||
m_source->PopEventHandler();
|
||||
|
||||
// This is a controlled exit. Purge saved state.
|
||||
wxString fileName(GetStateFileName());
|
||||
if (wxFileExists(fileName))
|
||||
wxRemoveFile(fileName);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::RestoreFromStateFile()
|
||||
{
|
||||
// Restore the previously saved state (if exists).
|
||||
wxString fileName(GetStateFileName());
|
||||
if (wxFileExists(fileName)) {
|
||||
@ -83,17 +98,6 @@ wxZRColaComposerPanel::wxZRColaComposerPanel(wxWindow* parent) :
|
||||
}
|
||||
|
||||
|
||||
wxZRColaComposerPanel::~wxZRColaComposerPanel()
|
||||
{
|
||||
m_source->PopEventHandler();
|
||||
|
||||
// This is a controlled exit. Purge saved state.
|
||||
wxString fileName(GetStateFileName());
|
||||
if (wxFileExists(fileName))
|
||||
wxRemoveFile(fileName);
|
||||
}
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::SynchronizePanels()
|
||||
{
|
||||
if (m_sourceChanged) {
|
||||
@ -193,7 +197,6 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxZRColaComposerPanel::OnSourcePaint(wxPaintEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
wxZRColaComposerPanel(wxWindow* parent);
|
||||
virtual ~wxZRColaComposerPanel();
|
||||
|
||||
void RestoreFromStateFile();
|
||||
void SynchronizePanels();
|
||||
|
||||
friend class wxPersistentZRColaComposerPanel; // Allow saving/restoring window state.
|
||||
|
Loading…
x
Reference in New Issue
Block a user