safe destruction, even if redraws might be triggered

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26056 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2004-03-03 10:47:57 +00:00
parent b2247ee93b
commit 21956470c7
2 changed files with 14 additions and 4 deletions

View File

@ -72,16 +72,19 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
Cell cell, short dataOffset, short dataLength,
ListHandle listHandle )
{
wxListBox* list;
list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
if ( list == NULL )
return ;
GrafPtr savePort;
GrafPtr grafPtr;
RgnHandle savedClipRegion;
SInt32 savedPenMode;
wxListBox* list;
GetPort(&savePort);
SetPort((**listHandle).port);
grafPtr = (**listHandle).port ;
// typecast our refCon
list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
// Calculate the cell rect.
@ -313,6 +316,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
wxListBox::~wxListBox()
{
FreeData() ;
// avoid access during destruction
SetControlReference( (ControlHandle) m_macControl , NULL ) ;
if ( m_macList )
{
#if !TARGET_CARBON

View File

@ -72,16 +72,19 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
Cell cell, short dataOffset, short dataLength,
ListHandle listHandle )
{
wxListBox* list;
list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
if ( list == NULL )
return ;
GrafPtr savePort;
GrafPtr grafPtr;
RgnHandle savedClipRegion;
SInt32 savedPenMode;
wxListBox* list;
GetPort(&savePort);
SetPort((**listHandle).port);
grafPtr = (**listHandle).port ;
// typecast our refCon
list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
// Calculate the cell rect.
@ -313,6 +316,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
wxListBox::~wxListBox()
{
FreeData() ;
// avoid access during destruction
SetControlReference( (ControlHandle) m_macControl , NULL ) ;
if ( m_macList )
{
#if !TARGET_CARBON