]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/cmndata.cpp
pass correct tool id (and not always -1) to EVT_TOOL_RCLICKED() handler
[wxWidgets.git] / src / common / cmndata.cpp
index 39e55667e6cc21c6fa3c50a3c16c7535cddbcad7..bb44120bcf56bd152efe1d73d06fef698e42ff39 100644 (file)
@@ -49,7 +49,7 @@
     #include "wx/paper.h"
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
     #include "wx/paper.h"
 #endif // wxUSE_PRINTING_ARCHITECTURE
 
-#if defined(__WXMSW__) && !defined(__PALMOS__)
+#if defined(__WXMSW__)
     #include <windowsx.h>
     #include "wx/msw/private.h"
 
     #include <windowsx.h>
     #include "wx/msw/private.h"
 
@@ -190,15 +190,16 @@ wxPrintData::wxPrintData()
 wxPrintData::wxPrintData(const wxPrintData& printData)
     : wxObject()
 {
 wxPrintData::wxPrintData(const wxPrintData& printData)
     : wxObject()
 {
+    m_nativeData = NULL;
     (*this) = printData;
 }
 
 wxPrintData::~wxPrintData()
 {
     m_nativeData->m_ref--;
     (*this) = printData;
 }
 
 wxPrintData::~wxPrintData()
 {
     m_nativeData->m_ref--;
-    if (m_nativeData->m_ref == 0) 
+    if (m_nativeData->m_ref == 0)
         delete m_nativeData;
         delete m_nativeData;
-        
+
 #ifdef __WXMAC__
     delete m_nativePrintData ;
 #endif
 #ifdef __WXMAC__
     delete m_nativePrintData ;
 #endif
@@ -235,16 +236,19 @@ void wxPrintData::operator=(const wxPrintData& data)
     m_paperSize = data.m_paperSize;
     m_bin = data.m_bin;
     m_printMode = data.m_printMode;
     m_paperSize = data.m_paperSize;
     m_bin = data.m_bin;
     m_printMode = data.m_printMode;
-    m_filename = data.m_filename;   
+    m_filename = data.m_filename;
 
 
-    // UnRef old m_nativeData    
-    m_nativeData->m_ref--;
-    if (m_nativeData->m_ref == 0) 
-        delete m_nativeData;
+    // UnRef old m_nativeData
+    if (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++;
     // Set Ref new one
     m_nativeData = data.GetNativeData();
     m_nativeData->m_ref++;
-    
+
 #ifdef __WXMAC__
     m_nativePrintData->CopyFrom( data.m_nativePrintData ) ;
 #endif
 #ifdef __WXMAC__
     m_nativePrintData->CopyFrom( data.m_nativePrintData ) ;
 #endif
@@ -440,10 +444,10 @@ wxPrintDialogData::wxPrintDialogData()
     m_printSelection = false;
     m_printEnableSelection = false;
     m_printEnablePageNumbers = true;
     m_printSelection = false;
     m_printEnableSelection = false;
     m_printEnablePageNumbers = true;
-    
+
     wxPrintFactory* factory = wxPrintFactory::GetFactory();
     m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
     wxPrintFactory* factory = wxPrintFactory::GetFactory();
     m_printEnablePrintToFile = ! factory->HasOwnPrintToFile();
-    
+
     m_printEnableHelp = false;
 #if WXWIN_COMPATIBILITY_2_4
     m_printSetupDialog = false;
     m_printEnableHelp = false;
 #if WXWIN_COMPATIBILITY_2_4
     m_printSetupDialog = false;