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