summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-22 13:33:11 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-22 13:33:11 +0100
commitc0e04acd1e9875fa67800a7861bd8a370157b49f (patch)
tree418dc2124d14c82fade43e3b47043f1ee69e331e /src/lib/util.cc
parent4cb33e432c7070f59c3ee3fbeb0b5c8755bba3bd (diff)
Fix crash on using delay; fix x-thread GUI access caused by FilmState default copy constructor copying its Changed signal's connections; fix up delay setup after film examine.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 52a75474b..6221b8b62 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -36,6 +36,7 @@
#include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lexical_cast.hpp>
+#include <boost/thread.hpp>
#include <openjpeg.h>
#include <openssl/md5.h>
#include <magick/MagickCore.h>
@@ -65,6 +66,8 @@ extern "C" {
using namespace std;
using namespace boost;
+thread::id ui_thread;
+
/** Convert some number of seconds to a string representation
* in hours, minutes and seconds.
*
@@ -265,7 +268,9 @@ sigchld_handler (int, siginfo_t* info, void *)
}
#endif
-/** Call the required functions to set up DVD-o-matic's static arrays, etc. */
+/** Call the required functions to set up DVD-o-matic's static arrays, etc.
+ * Must be called from the UI thread, if there is one.
+ */
void
dvdomatic_setup ()
{
@@ -275,6 +280,8 @@ dvdomatic_setup ()
Filter::setup_filters ();
SoundProcessor::setup_sound_processors ();
+ ui_thread = this_thread::get_id ();
+
#ifdef DVDOMATIC_POSIX
struct sigaction sa;
sa.sa_flags = SA_SIGINFO;
@@ -727,5 +734,8 @@ AudioBuffers::set_frames (int f)
_frames = f;
}
-
-
+void
+ensure_ui_thread ()
+{
+ assert (this_thread::get_id() == ui_thread);
+}