From f74cd31aa1b14816716ee1ffc59e99d4cc350dd5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 30 Dec 2013 22:53:23 +0000 Subject: Vaguely improve exception safety of ThreadedStaticText. --- src/wx/wx_util.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 103d36d00..367d1edbb 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -140,11 +140,18 @@ ThreadedStaticText::~ThreadedStaticText () /** Run our thread and post the result to the GUI thread via AddPendingEvent */ void ThreadedStaticText::run (function 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 -- cgit v1.2.3