mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-22 14:20:35 +08:00
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:
+14
-8
@@ -706,7 +706,9 @@ WX_ARG_FEATURE(geometry, [ --enable-geometry use geometry class], wx
|
||||
WX_ARG_FEATURE(log, [ --enable-log use logging system], wxUSE_LOG)
|
||||
WX_ARG_FEATURE(longlong, [ --enable-longlong use wxLongLong class], wxUSE_LONGLONG)
|
||||
WX_ARG_FEATURE(mimetype, [ --enable-mimetype use wxMimeTypesManager], wxUSE_MIMETYPE)
|
||||
WX_ARG_FEATURE(printfposparam,[ --enable-printfposparam use wxVsnprintf() which supports positional parameters], wxUSE_PRINTF_POS_PARAMS)
|
||||
WX_ARG_FEATURE(snglinst, [ --enable-snglinst use wxSingleInstanceChecker class], wxUSE_SNGLINST_CHECKER)
|
||||
WX_ARG_FEATURE(sound, [ --enable-sound use wxSound class], wxUSE_SOUND)
|
||||
WX_ARG_FEATURE(stdpaths, [ --enable-stdpaths use wxStandardPaths class], wxUSE_STDPATHS)
|
||||
WX_ARG_FEATURE(stopwatch, [ --enable-stopwatch use wxStopWatch class], wxUSE_STOPWATCH)
|
||||
WX_ARG_FEATURE(streams, [ --enable-streams use wxStream etc classes], wxUSE_STREAMS)
|
||||
@@ -715,14 +717,12 @@ WX_ARG_FEATURE(tarstream, [ --enable-tarstream use wxTar streams], wxU
|
||||
WX_ARG_FEATURE(textbuf, [ --enable-textbuf use wxTextBuffer class], wxUSE_TEXTBUFFER)
|
||||
WX_ARG_FEATURE(textfile, [ --enable-textfile use wxTextFile class], wxUSE_TEXTFILE)
|
||||
WX_ARG_FEATURE(timer, [ --enable-timer use wxTimer class], wxUSE_TIMER)
|
||||
WX_ARG_FEATURE(sound, [ --enable-sound use wxSound class], wxUSE_SOUND)
|
||||
WX_ARG_FEATURE(mediactrl, [ --enable-mediactrl use wxMediaCtrl class], wxUSE_MEDIACTRL)
|
||||
WX_ARG_FEATURE(gstreamer8, [ --enable-gstreamer8 force GStreamer 0.8 instead of 0.10 with the wxMediaCtrl class on unix], wxUSE_GSTREAMER8)
|
||||
WX_ARG_FEATURE(printfposparam,[ --enable-printfposparam use wxVsnprintf() which supports positional parameters], wxUSE_PRINTF_POS_PARAMS)
|
||||
WX_ARG_FEATURE(variant, [ --enable-variant use wxVariant class], wxUSE_VARIANT)
|
||||
WX_ARG_FEATURE(weakref, [ --enable-weakref make wxEvtHandler trackable with wxWeakRef<>], wxUSE_WEAKREF)
|
||||
WX_ARG_FEATURE(zipstream, [ --enable-zipstream use wxZip streams], wxUSE_ZIPSTREAM)
|
||||
|
||||
dnl URL-related classes
|
||||
WX_ARG_FEATURE(url, [ --enable-url use wxURL class], wxUSE_URL)
|
||||
WX_ARG_FEATURE(variant, [ --enable-variant use wxVariant class], wxUSE_VARIANT)
|
||||
WX_ARG_FEATURE(protocol, [ --enable-protocol use wxProtocol class], wxUSE_PROTOCOL)
|
||||
WX_ARG_FEATURE(protocol_http, [ --enable-protocol-http HTTP support in wxProtocol], wxUSE_PROTOCOL_HTTP)
|
||||
WX_ARG_FEATURE(protocol_ftp, [ --enable-protocol-ftp FTP support in wxProtocol], wxUSE_PROTOCOL_FTP)
|
||||
@@ -748,16 +748,18 @@ WX_ARG_FEATURE(xrc, [ --enable-xrc use XRC resources sub-lib
|
||||
WX_ARG_FEATURE(aui, [ --enable-aui use AUI docking library], wxUSE_AUI)
|
||||
WX_ARG_FEATURE(stc, [ --enable-stc use wxStyledTextCtrl library], wxUSE_STC)
|
||||
WX_ARG_FEATURE(constraints, [ --enable-constraints use layout-constraints system], wxUSE_CONSTRAINTS)
|
||||
WX_ARG_FEATURE(printarch, [ --enable-printarch use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
|
||||
WX_ARG_FEATURE(mdi, [ --enable-mdi use multiple document interface architecture], wxUSE_MDI)
|
||||
WX_ARG_FEATURE(mdidoc, [ --enable-mdidoc use docview architecture with MDI], wxUSE_MDI_ARCHITECTURE)
|
||||
WX_ARG_FEATURE(loggui, [ --enable-loggui use standard GUI logger], wxUSE_LOGGUI)
|
||||
WX_ARG_FEATURE(logwin, [ --enable-logwin use wxLogWindow], wxUSE_LOGWINDOW)
|
||||
WX_ARG_FEATURE(logdialog, [ --enable-logdialog use wxLogDialog], wxUSE_LOGDIALOG)
|
||||
WX_ARG_FEATURE(mdi, [ --enable-mdi use multiple document interface architecture], wxUSE_MDI)
|
||||
WX_ARG_FEATURE(mdidoc, [ --enable-mdidoc use docview architecture with MDI], wxUSE_MDI_ARCHITECTURE)
|
||||
WX_ARG_FEATURE(mediactrl, [ --enable-mediactrl use wxMediaCtrl class], wxUSE_MEDIACTRL)
|
||||
WX_ARG_FEATURE(gstreamer8, [ --enable-gstreamer8 force GStreamer 0.8 instead of 0.10 with the wxMediaCtrl class on unix], wxUSE_GSTREAMER8)
|
||||
WX_ARG_FEATURE(webkit, [ --enable-webkit use wxWebKitCtrl (Mac)], wxUSE_WEBKIT)
|
||||
WX_ARG_FEATURE(richtext, [ --enable-richtext use wxRichTextCtrl], wxUSE_RICHTEXT)
|
||||
WX_ARG_FEATURE(graphics_ctx,[ --enable-graphics_ctx use graphics context 2D drawing API], wxUSE_GRAPHICS_CONTEXT)
|
||||
WX_ARG_FEATURE(postscript, [ --enable-postscript use wxPostscriptDC device context (default for gtk+)], wxUSE_POSTSCRIPT)
|
||||
WX_ARG_FEATURE(printarch, [ --enable-printarch use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
|
||||
WX_ARG_FEATURE(svg, [ --enable-svg use wxSVGFileDC device context], wxUSE_SVG)
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
@@ -6052,6 +6054,10 @@ if test "$wxUSE_VARIANT" = "yes"; then
|
||||
AC_DEFINE(wxUSE_VARIANT)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_WEAKREF" = "yes"; then
|
||||
AC_DEFINE(wxUSE_WEAKREF)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_FS_INET" = "yes"; then
|
||||
AC_DEFINE(wxUSE_FS_INET)
|
||||
fi
|
||||
|
||||
@@ -291,6 +291,14 @@
|
||||
# endif
|
||||
#endif /* wxUSE_VARIANT */
|
||||
|
||||
#ifndef wxUSE_WEAKREF
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_WEAKREF must be defined."
|
||||
# else
|
||||
# define wxUSE_WEAKREF 0
|
||||
# endif
|
||||
#endif /* wxUSE_WEAKREF */
|
||||
|
||||
/*
|
||||
Section 1b: all these tests are for GUI only.
|
||||
|
||||
|
||||
+10
-1
@@ -2258,7 +2258,10 @@ protected:
|
||||
// wxEvtHandler: the base class for all objects handling wxWidgets events
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject, public wxTrackable
|
||||
class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
|
||||
#if wxUSE_WEAKREF
|
||||
, public wxTrackable
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
wxEvtHandler();
|
||||
@@ -2358,7 +2361,9 @@ public:
|
||||
|
||||
// Avoid problems at exit by cleaning up static hash table gracefully
|
||||
void ClearEventHashTable() { GetEventHashTable().Clear(); }
|
||||
#if wxUSE_WEAKREF
|
||||
void OnSinkDestroyed( wxEvtHandler *sink );
|
||||
#endif
|
||||
|
||||
private:
|
||||
static const wxEventTableEntry sm_eventTableEntries[];
|
||||
@@ -2425,13 +2430,16 @@ protected:
|
||||
virtual void DoSetClientData( void *data );
|
||||
virtual void *DoGetClientData() const;
|
||||
|
||||
#if wxUSE_WEAKREF
|
||||
// Search tracker objects for event connection with this sink
|
||||
wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *eventSink);
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler)
|
||||
};
|
||||
|
||||
#if wxUSE_WEAKREF
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxEventConnectionRef represents all connections between two event handlers
|
||||
// and enables automatic disconnect when an event handler sink goes out of
|
||||
@@ -2480,6 +2488,7 @@ private:
|
||||
|
||||
DECLARE_NO_ASSIGN_CLASS(wxEventConnectionRef)
|
||||
};
|
||||
#endif // wxUSE_WEAKREF
|
||||
|
||||
// Post a message to the given eventhandler which will be processed during the
|
||||
// next event loop iteration
|
||||
|
||||
@@ -235,6 +235,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -234,6 +234,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -234,6 +234,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -234,6 +234,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -234,6 +234,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -234,6 +234,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -230,6 +230,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -233,6 +233,16 @@
|
||||
// Recommended setting: 0 unless you do plan to develop MT applications
|
||||
#define wxUSE_THREADS 1
|
||||
|
||||
// Set wxUSE_WEAKREF to 1 t support use of weak references to common classes
|
||||
// in wxWidgets (wxWeakRef<T>). Set to 0 if your compiler has problems with
|
||||
// the template-based implementation (Embedded Visual C++ 4 for ARM has a bug
|
||||
// in this area, Visual C compiler options "/vmm /vmg" may help then).
|
||||
//
|
||||
// Default is 1
|
||||
//
|
||||
// Recommended setting: 1
|
||||
#define wxUSE_WEAKREF 1
|
||||
|
||||
// If enabled, compiles wxWidgets streams classes
|
||||
//
|
||||
// wx stream classes are used for image IO, process IO redirection, network
|
||||
|
||||
@@ -196,6 +196,8 @@
|
||||
|
||||
#define wxUSE_THREADS 0
|
||||
|
||||
#define wxUSE_WEAKREF 0
|
||||
|
||||
#define wxUSE_STREAMS 0
|
||||
|
||||
#define wxUSE_STD_IOSTREAM 0
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user