#endif
#include "wx/thread.h"
-#include "wx/ptr_scpd.h"
-wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr)
-wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr)
+#if wxUSE_BASE
+ #include "wx/ptr_scpd.h"
+
+ wxDECLARE_SCOPED_PTR(wxEvent, wxEventPtr)
+ wxDEFINE_SCOPED_PTR(wxEvent, wxEventPtr)
+#endif // wxUSE_BASE
// ----------------------------------------------------------------------------
// wxWin macros
{
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;
delete evtConnRef;
}
}
+#endif // wxUSE_WEAKREF
if (entry->m_callbackUserData)
delete entry->m_callbackUserData;
// 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 )
+ if ( eventSink && eventSink != this )
{
wxEventConnectionRef *evtConnRef = FindRefInTrackerList(eventSink);
if ( evtConnRef )
else
evtConnRef = new wxEventConnectionRef(this, eventSink);
}
+#endif // wxUSE_WEAKREF
}
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 )
+ if ( eventSink && eventSink != this )
{
wxEventConnectionRef *evtConnRef = FindRefInTrackerList(eventSink);
if ( evtConnRef )
evtConnRef->DecRef();
}
+#endif // wxUSE_WEAKREF
wxList::compatibility_iterator node = m_dynamicEvents->GetFirst();
while (node)
return m_clientData;
}
+#if wxUSE_WEAKREF
// A helper to find an wxEventConnectionRef object
wxEventConnectionRef *
wxEvtHandler::FindRefInTrackerList(wxEvtHandler *eventSink)
node = node_nxt;
}
}
+#endif // wxUSE_WEAKREF
#endif // wxUSE_BASE