wxTimer::Notify doesn't propagate exceptions

10 views
Skip to first unread message

Dion Whittaker

unread,
Nov 22, 2009, 5:14:51 AM11/22/09
to wx-u...@googlegroups.com
Hi,

Trying to implement an inactivity timeout for my application I
implemented a wxTimer derived class with the Notify function overidden.
I found that when throwing an exception in the Notify function the
exception would not be caught in wxApp::OnExceptionInMainLoop, instead
the app would exit (with the debugger indicating the exception thrown).

I changed my wxTimer derived class to instead Bind a class function as
the timer handler, the exception was then caught by OnExceptionInMainLoop.

Probably not a common situation, and a pretty easy work-around but
thought you might like to know.

wxWidgets 2.9.0
OS X 10.6 using g++-4.0, OS X SDK 10.4

Regards
Dion

Vadim Zeitlin

unread,
Nov 22, 2009, 6:01:50 AM11/22/09
to wx-u...@googlegroups.com
On Sun, 22 Nov 2009 18:14:51 +0800 Dion Whittaker <dwhit...@cnsvs.com> wrote:

DW> I found that when throwing an exception in the Notify function the
DW> exception would not be caught in wxApp::OnExceptionInMainLoop, instead
DW> the app would exit (with the debugger indicating the exception thrown).

This is definitely a bug and it exists in all ports I looked at (OS X,
GTK, MSW). I don't have time to fix it now but I'll at least mention it in
the documentation, thanks for reporting.

FWIW I can also confirm that your workaround is the right/best thing to do
currently.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Reply all
Reply to author
Forward
0 new messages