adding an autorelease capability (got weird crashes when deleting tools from a toolbar otherwise)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -75,6 +75,10 @@ public:
|
||||
void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler )
|
||||
{ m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; }
|
||||
|
||||
// adding a CFType object to be released only at the end of the current event cycle (increases the
|
||||
// refcount of the object passed), needed in case we are in the middle of an event concering an object
|
||||
// we want to delete and cannot do it immediately
|
||||
void MacAddToAutorelease( void* cfrefobj );
|
||||
public:
|
||||
static wxWindow* s_captureWindow ;
|
||||
static long s_lastModifiers ;
|
||||
|
@@ -1231,6 +1231,14 @@ void wxApp::MacHandleUnhandledEvent( WXEVENTREF evr )
|
||||
// Override to process unhandled events as you please
|
||||
}
|
||||
|
||||
CFMutableArrayRef GetAutoReleaseArray()
|
||||
{
|
||||
static CFMutableArrayRef array = 0;
|
||||
if ( array == 0)
|
||||
array= CFArrayCreateMutable(kCFAllocatorDefault,0,&kCFTypeArrayCallBacks);
|
||||
return array;
|
||||
}
|
||||
|
||||
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||
{
|
||||
EventTargetRef theTarget;
|
||||
@@ -1246,6 +1254,13 @@ void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||
#if wxUSE_THREADS
|
||||
wxMutexGuiLeaveOrEnter();
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
CFArrayRemoveAllValues( GetAutoReleaseArray() );
|
||||
}
|
||||
|
||||
void wxApp::MacAddToAutorelease( void* cfrefobj )
|
||||
{
|
||||
CFArrayAppendValue( GetAutoReleaseArray(), cfrefobj );
|
||||
}
|
||||
|
||||
long wxMacTranslateKey(unsigned char key, unsigned char code)
|
||||
|
Reference in New Issue
Block a user