: wxStaticText (parent, wxID_ANY, std_to_wx (initial))
{
Connect (_update_event_id, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ThreadedStaticText::thread_finished), 0, this);
- thread t (bind (&ThreadedStaticText::run, this, fn));
+ _thread = new thread (bind (&ThreadedStaticText::run, this, fn));
+}
+
+ThreadedStaticText::~ThreadedStaticText ()
+{
+ /* XXX: this is a bit unfortunate */
+ _thread->join ();
+ delete _thread;
}
void
#include <wx/wx.h>
#include <boost/function.hpp>
+#include <boost/thread.hpp>
/** @file src/wx/wx_util.h
* @brief Some utility functions and classes.
{
public:
ThreadedStaticText (wxWindow* parent, std::string initial, boost::function<std::string ()> fn);
+ ~ThreadedStaticText ();
private:
void run (boost::function<std::string ()> fn);
void thread_finished (wxCommandEvent& ev);
+ boost::thread* _thread;
+
static const int _update_event_id;
};