Fix for uninitialized pointer access from wxPrintData's copy ctor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30510 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-11-13 02:26:20 +00:00
parent d4808d76f9
commit 7b8a9da3c8

View File

@@ -190,6 +190,7 @@ wxPrintData::wxPrintData()
wxPrintData::wxPrintData(const wxPrintData& printData) wxPrintData::wxPrintData(const wxPrintData& printData)
: wxObject() : wxObject()
{ {
m_nativeData = NULL;
(*this) = printData; (*this) = printData;
} }
@@ -238,9 +239,12 @@ void wxPrintData::operator=(const wxPrintData& data)
m_filename = data.m_filename; m_filename = data.m_filename;
// UnRef old m_nativeData // UnRef old m_nativeData
if (m_nativeData)
{
m_nativeData->m_ref--; m_nativeData->m_ref--;
if (m_nativeData->m_ref == 0) if (m_nativeData->m_ref == 0)
delete m_nativeData; delete m_nativeData;
}
// Set Ref new one // Set Ref new one
m_nativeData = data.GetNativeData(); m_nativeData = data.GetNativeData();
m_nativeData->m_ref++; m_nativeData->m_ref++;