fixed crash when closing window that contains STC (patch 1017268)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29196 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-09-18 12:09:12 +00:00
parent 6d20f7ae50
commit 8b573fb839

View File

@@ -63,7 +63,7 @@
#if TARGET_API_MAC_OSX
#ifndef __HIVIEW__
#include <HIToolbox/HIView.h>
#include <HIToolbox/HIView.h>
#endif
#endif
@@ -180,7 +180,7 @@ static const EventTypeSpec eventList[] =
{ kEventClassService , kEventServiceCopy },
{ kEventClassService , kEventServicePaste },
// { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only
// { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only
// { kEventClassControl , kEventControlBoundsChanged } ,
#endif
} ;
@@ -228,19 +228,19 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
{
static float color = 0.5 ;
static channel = 0 ;
HIRect bounds;
HIViewGetBounds( controlRef, &bounds );
CGContextSetRGBFillColor( cgContext, channel == 0 ? color : 0.5 ,
channel == 1 ? color : 0.5 , channel == 2 ? color : 0.5 , 1 );
CGContextFillRect( cgContext, bounds );
color += 0.1 ;
if ( color > 0.9 )
{
color = 0.5 ;
channel++ ;
if ( channel == 3 )
channel = 0 ;
}
HIRect bounds;
HIViewGetBounds( controlRef, &bounds );
CGContextSetRGBFillColor( cgContext, channel == 0 ? color : 0.5 ,
channel == 1 ? color : 0.5 , channel == 2 ? color : 0.5 , 1 );
CGContextFillRect( cgContext, bounds );
color += 0.1 ;
if ( color > 0.9 )
{
color = 0.5 ;
channel++ ;
if ( channel == 3 )
channel = 0 ;
}
}
#endif
if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) )
@@ -742,6 +742,9 @@ wxWindowMac::~wxWindowMac()
}
#endif // __WXUNIVERSAL__
// destroy children before destroying this window itself
DestroyChildren();
// wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
@@ -772,8 +775,6 @@ wxWindowMac::~wxWindowMac()
frame->SetLastFocus( NULL ) ;
}
DestroyChildren();
// delete our drop target if we've got one
#if wxUSE_DRAG_AND_DROP
if ( m_dropTarget != NULL )
@@ -821,15 +822,15 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id,
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
UInt32 features = 0
| kControlSupportsEmbedding
// | kControlSupportsLiveFeedback
// | kControlHasSpecialBackground
// | kControlSupportsCalcBestRect
// | kControlHandlesTracking
| kControlSupportsFocus
// | kControlWantsActivate
// | kControlWantsIdle
;
| kControlSupportsEmbedding
// | kControlSupportsLiveFeedback
// | kControlHasSpecialBackground
// | kControlSupportsCalcBestRect
// | kControlHandlesTracking
| kControlSupportsFocus
// | kControlWantsActivate
// | kControlWantsIdle
;
m_peer = new wxMacControl() ;
::CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, features , m_peer->GetControlRefAddr() );
@@ -903,7 +904,7 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
if (m_peer == NULL || !m_peer->Ok())
return;
ControlSize size ;
ControlSize size ;
ThemeFontID themeFont = kThemeSystemFont ;
// we will get that from the settings later
@@ -914,28 +915,28 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
{
case wxWINDOW_VARIANT_NORMAL :
size = kControlSizeNormal;
themeFont = kThemeSystemFont ;
themeFont = kThemeSystemFont ;
break ;
case wxWINDOW_VARIANT_SMALL :
size = kControlSizeSmall;
themeFont = kThemeSmallSystemFont ;
themeFont = kThemeSmallSystemFont ;
break ;
case wxWINDOW_VARIANT_MINI :
if (UMAGetSystemVersion() >= 0x1030 )
{
// not always defined in the headers
size = 3 ;
themeFont = 109 ;
themeFont = 109 ;
}
else
{
size = kControlSizeSmall;
themeFont = kThemeSmallSystemFont ;
themeFont = kThemeSmallSystemFont ;
}
break ;
case wxWINDOW_VARIANT_LARGE :
size = kControlSizeLarge;
themeFont = kThemeSystemFont ;
themeFont = kThemeSystemFont ;
break ;
default:
wxFAIL_MSG(_T("unexpected window variant"));
@@ -951,7 +952,7 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
void wxWindowMac::MacUpdateControlFont()
{
m_peer->SetFont( GetFont() , GetForegroundColour() , GetWindowStyle() ) ;
Refresh() ;
Refresh() ;
}
bool wxWindowMac::SetFont(const wxFont& font)
@@ -2090,7 +2091,7 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
return ;
if ( !m_peer->IsVisible())
return ;
return ;
wxPoint client = GetClientAreaOrigin();
int x1 = -client.x;
@@ -2913,12 +2914,12 @@ void wxWindowMac::MacCreateScrollBars( long style )
{
bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
int scrlsize = MAC_SCROLLBAR_SIZE ;
wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL ;
if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL || GetWindowVariant() == wxWINDOW_VARIANT_MINI )
{
scrlsize = MAC_SMALL_SCROLLBAR_SIZE ;
variant = wxWINDOW_VARIANT_SMALL ;
}
wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL ;
if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL || GetWindowVariant() == wxWINDOW_VARIANT_MINI )
{
scrlsize = MAC_SMALL_SCROLLBAR_SIZE ;
variant = wxWINDOW_VARIANT_SMALL ;
}
int adjust = hasBoth ? scrlsize - 1: 0 ;
int width, height ;
@@ -3122,9 +3123,9 @@ wxPoint wxGetMousePosition()
void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
{
if ( event.GetEventType() == wxEVT_RIGHT_DOWN )
{
// copied from wxGTK : CS
if ( event.GetEventType() == wxEVT_RIGHT_DOWN )
{
// copied from wxGTK : CS
// generate a "context menu" event: this is similar to wxEVT_RIGHT_DOWN
// except that:
//
@@ -3136,10 +3137,10 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
this->ClientToScreen(event.GetPosition()));
if ( ! GetEventHandler()->ProcessEvent(evtCtx) )
event.Skip() ;
}
}
else
{
event.Skip() ;
event.Skip() ;
}
}