X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72259e00633be1e01a10cb4d6eba33f8a5fca228..8a462d4ee12820a8ee404eef060e5cd406ba3f09:/src/common/cmndata.cpp diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 39e55667e6..37e2d98304 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -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++;