diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 7b94879e58..6ab6b2c5f1 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -281,6 +281,10 @@ void wxAppConsoleBase::OnLaunched() int wxAppConsoleBase::OnExit() { + // Delete all pending objects first, they might use wxConfig to save their + // state during their destruction. + DeletePendingObjects(); + #if wxUSE_CONFIG // delete the config object if any (don't use Get() here, but Set() // because Get() could create a new config object) diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 89494b73ce..fc784f6e7c 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -129,7 +129,10 @@ wxAppBase::~wxAppBase() void wxAppBase::CleanUp() { - // clean up all the pending objects + // Clean up any still pending objects. Normally there shouldn't any as we + // already do this in OnExit(), but this could happen if the user code has + // somehow managed to create more of them since then or just forgot to call + // the base class OnExit(). DeletePendingObjects(); // and any remaining TLWs (they remove themselves from wxTopLevelWindows