diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 43bd65360c..0c15d2a85d 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -46,6 +46,7 @@ #include "wx/thread.h" #include "wx/utils.h" #include "wx/ptr_scpd.h" +#include "wx/prntbase.h" #if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/private.h" // includes windows.h for LOGFONT @@ -139,6 +140,8 @@ void wxAppBase::CleanUp() // but we want to delete them now delete wxTopLevelWindows.GetFirst()->GetData(); } + + wxPrintFactory::SetPrintFactory( NULL ); // undo everything we did in Initialize() above wxBitmap::CleanUpHandlers(); diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 3652abefa9..dc13526103 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -237,7 +237,12 @@ void wxPrintData::operator=(const wxPrintData& data) m_bin = data.m_bin; m_printMode = data.m_printMode; m_filename = data.m_filename; - + + // UnRef old m_nativeData + m_nativeData->m_ref--; + if (m_nativeData->m_ref == 0) + delete m_nativeData; + // Set Ref new one m_nativeData = data.GetNativeData(); m_nativeData->m_ref++;