Vaguely improve exception safety of ThreadedStaticText.
authorCarl Hetherington <cth@carlh.net>
Mon, 30 Dec 2013 22:53:23 +0000 (22:53 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 30 Dec 2013 22:53:23 +0000 (22:53 +0000)
src/wx/wx_util.cc

index 103d36d006d1539043f8c357fae1ebdf98ceb0f7..367d1edbbf522d12634dbc2c967bea73732f83cd 100644 (file)
@@ -140,11 +140,18 @@ ThreadedStaticText::~ThreadedStaticText ()
 /** Run our thread and post the result to the GUI thread via AddPendingEvent */
 void
 ThreadedStaticText::run (function<string ()> fn)
+try
 {
        wxCommandEvent ev (wxEVT_COMMAND_TEXT_UPDATED, _update_event_id);
        ev.SetString (std_to_wx (fn ()));
        GetEventHandler()->AddPendingEvent (ev);
 }
+catch (...)
+{
+       /* Ignore exceptions; marginally better than the program quitting, but
+          only marginally.
+       */
+}
 
 /** Called in the GUI thread when our worker thread has finished */
 void