]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix for uninitialized pointer access from wxPrintData's copy ctor
authorRobin Dunn <robin@alldunn.com>
Sat, 13 Nov 2004 02:26:20 +0000 (02:26 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 13 Nov 2004 02:26:20 +0000 (02:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30510 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/cmndata.cpp

index 39e55667e6cc21c6fa3c50a3c16c7535cddbcad7..37e2d98304849dc8c2b390cbece5cb6c44bcbfe5 100644 (file)
@@ -190,6 +190,7 @@ wxPrintData::wxPrintData()
 wxPrintData::wxPrintData(const wxPrintData& printData)
     : wxObject()
 {
+    m_nativeData = NULL;
     (*this) = printData;
 }
 
@@ -237,10 +238,13 @@ void wxPrintData::operator=(const wxPrintData& data)
     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;
+    // 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++;