From 7b8a9da3c8d802359e6661438b048c663f5e3392 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 13 Nov 2004 02:26:20 +0000 Subject: [PATCH] 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 --- src/common/cmndata.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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++; -- 2.47.2