rolled back exceptions handling patch, it relied on incorrect assumption about vtables
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34721 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -433,12 +433,6 @@ public:
|
|||||||
// Perform standard OnIdle behaviour: call from port's OnIdle
|
// Perform standard OnIdle behaviour: call from port's OnIdle
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
|
|
||||||
#if wxUSE_EXCEPTIONS
|
|
||||||
virtual void HandleEvent(wxEvtHandler *handler,
|
|
||||||
wxEventFunction func,
|
|
||||||
wxEvent& event) const;
|
|
||||||
#endif // wxUSE_EXCEPTIONS
|
|
||||||
|
|
||||||
|
|
||||||
// top level window functions
|
// top level window functions
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
@@ -2295,8 +2295,6 @@ protected:
|
|||||||
// wxEvtHandler: the base class for all objects handling wxWidgets events
|
// wxEvtHandler: the base class for all objects handling wxWidgets events
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
|
class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -2324,15 +2322,6 @@ public:
|
|||||||
bool ProcessThreadEvent(wxEvent& event);
|
bool ProcessThreadEvent(wxEvent& event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_EXCEPTIONS
|
|
||||||
// call the specified handler with the given event
|
|
||||||
//
|
|
||||||
// this method only exists to allow catching the exceptions thrown by any
|
|
||||||
// event handler, it would lead to an extra (useless) virtual function call
|
|
||||||
// if the exceptions were not used, so it doesn't even exist in that case
|
|
||||||
virtual void DoHandleEvent(wxEventFunction func, wxEvent& event);
|
|
||||||
#endif // wxUSE_EXCEPTIONS
|
|
||||||
|
|
||||||
// Dynamic association of a member function handler with the event handler,
|
// Dynamic association of a member function handler with the event handler,
|
||||||
// winid and event type
|
// winid and event type
|
||||||
void Connect(int winid,
|
void Connect(int winid,
|
||||||
@@ -2493,6 +2482,8 @@ inline void wxPostEvent(wxEvtHandler *dest, wxEvent& event)
|
|||||||
dest->AddPendingEvent(event);
|
dest->AddPendingEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
|
||||||
|
|
||||||
#define wxEventHandler(func) \
|
#define wxEventHandler(func) \
|
||||||
(wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func)
|
(wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func)
|
||||||
|
|
||||||
|
@@ -26,10 +26,6 @@
|
|||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxObject;
|
class WXDLLIMPEXP_BASE wxObject;
|
||||||
|
|
||||||
// FIXME: remove in wx-2.7:
|
|
||||||
class WXDLLIMPEXP_BASE wxEvent;
|
|
||||||
class WXDLLIMPEXP_BASE wxEvtHandler;
|
|
||||||
|
|
||||||
#ifndef wxUSE_EXTENDED_RTTI
|
#ifndef wxUSE_EXTENDED_RTTI
|
||||||
#define wxUSE_EXTENDED_RTTI 0
|
#define wxUSE_EXTENDED_RTTI 0
|
||||||
#endif
|
#endif
|
||||||
@@ -482,9 +478,7 @@ public:
|
|||||||
virtual void ReservedObjectFunc6() {}
|
virtual void ReservedObjectFunc6() {}
|
||||||
virtual void ReservedObjectFunc7() {}
|
virtual void ReservedObjectFunc7() {}
|
||||||
virtual void ReservedObjectFunc8() {}
|
virtual void ReservedObjectFunc8() {}
|
||||||
// FIXME: turn back into ReservedObjectFunc9() in wx-2.7 (see also FIXME
|
virtual void ReservedObjectFunc9() {}
|
||||||
// near the top of this file)
|
|
||||||
virtual void DoHandleEvent(void (wxEvtHandler::*)(wxEvent&), wxEvent&) {}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// ensure that our data is not shared with anybody else: if we have no
|
// ensure that our data is not shared with anybody else: if we have no
|
||||||
|
@@ -316,15 +316,8 @@ wxAppConsole::HandleEvent(wxEvtHandler *handler,
|
|||||||
wxEventFunction func,
|
wxEventFunction func,
|
||||||
wxEvent& event) const
|
wxEvent& event) const
|
||||||
{
|
{
|
||||||
// by default, call wxApp::OnExceptionInMainLoop if an exception occurs
|
// by default, simply call the handler
|
||||||
try
|
(handler->*func)(event);
|
||||||
{
|
|
||||||
handler->DoHandleEvent(func, event);
|
|
||||||
}
|
|
||||||
catch ( ... )
|
|
||||||
{
|
|
||||||
wxConstCast(this, wxAppConsole)->OnExceptionInMainLoop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@@ -46,7 +46,6 @@
|
|||||||
#include "wx/thread.h"
|
#include "wx/thread.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/ptr_scpd.h"
|
#include "wx/ptr_scpd.h"
|
||||||
#include "wx/evtloop.h"
|
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/private.h" // includes windows.h for LOGFONT
|
#include "wx/msw/private.h" // includes windows.h for LOGFONT
|
||||||
@@ -468,35 +467,6 @@ void wxAppBase::OnIdle(wxIdleEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// exception handling
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if wxUSE_EXCEPTIONS
|
|
||||||
|
|
||||||
void wxAppBase::HandleEvent(wxEvtHandler *handler,
|
|
||||||
wxEventFunction func,
|
|
||||||
wxEvent& event) const
|
|
||||||
{
|
|
||||||
// by default, call wxApp::OnExceptionInMainLoop if an exception occurs
|
|
||||||
try
|
|
||||||
{
|
|
||||||
handler->DoHandleEvent(func, event);
|
|
||||||
}
|
|
||||||
catch ( ... )
|
|
||||||
{
|
|
||||||
if ( !wxConstCast(this, wxAppBase)->OnExceptionInMainLoop() )
|
|
||||||
{
|
|
||||||
wxEventLoop *loop = wxEventLoop::GetActive();
|
|
||||||
if ( loop )
|
|
||||||
loop->Exit(-1);
|
|
||||||
}
|
|
||||||
//else: continue running the event loop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_EXCEPTIONS
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGUIAppTraitsBase
|
// wxGUIAppTraitsBase
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -1081,14 +1081,6 @@ void wxEvtHandler::ClearEventLocker()
|
|||||||
|
|
||||||
#endif // wxUSE_THREADS
|
#endif // wxUSE_THREADS
|
||||||
|
|
||||||
#if wxUSE_EXCEPTIONS
|
|
||||||
void wxEvtHandler::DoHandleEvent(wxEventFunction func, wxEvent& event)
|
|
||||||
{
|
|
||||||
// by default, just call then handler
|
|
||||||
(this->*func)(event);
|
|
||||||
}
|
|
||||||
#endif // wxUSE_EXCEPTIONS
|
|
||||||
|
|
||||||
void wxEvtHandler::AddPendingEvent(wxEvent& event)
|
void wxEvtHandler::AddPendingEvent(wxEvent& event)
|
||||||
{
|
{
|
||||||
// 1) Add event to list of pending events of this event handler
|
// 1) Add event to list of pending events of this event handler
|
||||||
|
@@ -207,10 +207,18 @@ int wxEventLoop::Run()
|
|||||||
// should undo
|
// should undo
|
||||||
wxEventLoopActivator activate(&ms_activeLoop, this);
|
wxEventLoopActivator activate(&ms_activeLoop, this);
|
||||||
|
|
||||||
|
// we must ensure that OnExit() is called even if an exception is thrown
|
||||||
|
// from inside Dispatch() but we must call it from Exit() in normal
|
||||||
|
// situations because it is supposed to be called synchronously,
|
||||||
|
// wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or
|
||||||
|
// something similar here)
|
||||||
#if wxUSE_EXCEPTIONS
|
#if wxUSE_EXCEPTIONS
|
||||||
|
for ( ;; )
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif
|
#endif // wxUSE_EXCEPTIONS
|
||||||
|
|
||||||
// this is the event loop itself
|
// this is the event loop itself
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
@@ -242,14 +250,32 @@ int wxEventLoop::Run()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_EXCEPTIONS
|
#if wxUSE_EXCEPTIONS
|
||||||
|
// exit the outer loop as well
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch ( ... )
|
catch ( ... )
|
||||||
{
|
{
|
||||||
// we need OnExit() to be called before the event loop stops
|
try
|
||||||
|
{
|
||||||
|
if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() )
|
||||||
|
{
|
||||||
|
OnExit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//else: continue running the event loop
|
||||||
|
}
|
||||||
|
catch ( ... )
|
||||||
|
{
|
||||||
|
// OnException() throwed, possibly rethrowing the same
|
||||||
|
// exception again: very good, but we still need OnExit() to
|
||||||
|
// be called
|
||||||
OnExit();
|
OnExit();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif // wxUSE_EXCEPTIONS
|
#endif // wxUSE_EXCEPTIONS
|
||||||
|
|
||||||
return m_exitcode;
|
return m_exitcode;
|
||||||
|
Reference in New Issue
Block a user