add wxUSE_WEAKREF (modified partially applied patch 1870445)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-02-09 14:40:26 +00:00
parent b721db1057
commit 4732e2dca9
14 changed files with 468 additions and 303 deletions

View File

@@ -1060,6 +1060,7 @@ wxEvtHandler::~wxEvtHandler()
{
wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)*it;
#if wxUSE_WEAKREF
// Remove ourselves from sink destructor notifications
// (this has usually been been done, in wxTrackable destructor)
wxEvtHandler *eventSink = entry->m_eventSink;
@@ -1073,6 +1074,7 @@ wxEvtHandler::~wxEvtHandler()
delete evtConnRef;
}
}
#endif // wxUSE_WEAKREF
if (entry->m_callbackUserData)
delete entry->m_callbackUserData;
@@ -1372,6 +1374,7 @@ void wxEvtHandler::Connect( int id, int lastId,
// Insert at the front of the list so most recent additions are found first
m_dynamicEvents->Insert( (wxObject*) entry );
#if wxUSE_WEAKREF
// Make sure we get to know when a sink is destroyed
if ( eventSink )
{
@@ -1381,6 +1384,7 @@ void wxEvtHandler::Connect( int id, int lastId,
else
evtConnRef = new wxEventConnectionRef(this, eventSink);
}
#endif // wxUSE_WEAKREF
}
bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType,
@@ -1391,6 +1395,7 @@ bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType,
if (!m_dynamicEvents)
return false;
#if wxUSE_WEAKREF
// Remove connection from tracker node (wxEventConnectionRef)
if ( eventSink )
{
@@ -1398,6 +1403,7 @@ bool wxEvtHandler::Disconnect( int id, int lastId, wxEventType eventType,
if ( evtConnRef )
evtConnRef->DecRef();
}
#endif // wxUSE_WEAKREF
wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
while (node)
@@ -1489,6 +1495,7 @@ void *wxEvtHandler::DoGetClientData() const
return m_clientData;
}
#if wxUSE_WEAKREF
// A helper to find an wxEventConnectionRef object
wxEventConnectionRef *
wxEvtHandler::FindRefInTrackerList(wxEvtHandler *eventSink)
@@ -1528,6 +1535,7 @@ void wxEvtHandler::OnSinkDestroyed( wxEvtHandler *sink )
node = node_nxt;
}
}
#endif // wxUSE_WEAKREF
#endif // wxUSE_BASE