get rid of the thread in the progressconnector. Not sure if helped with crashes

This commit is contained in:
Andrey Skvortsov
2010-09-21 21:24:02 -07:00
parent 7e7ce797e8
commit e23854a4f8

View File

@@ -22,6 +22,7 @@
#include <sigc++/sigc++.h> #include <sigc++/sigc++.h>
#include <gtkmm.h> #include <gtkmm.h>
#include <rtengine.h> #include <rtengine.h>
#include <simpleprocess.h>
#undef THREAD_PRIORITY_NORMAL #undef THREAD_PRIORITY_NORMAL
@@ -83,23 +84,23 @@ class ProgressConnector {
Glib::Mutex* qMutex; Glib::Mutex* qMutex;
static int emitEndSignal (void* data) { static int emitEndSignal (void* data) {
gdk_threads_enter (); // gdk_threads_enter ();
sigc::signal0<bool>* opEnd = (sigc::signal0<bool>*) data; sigc::signal0<bool>* opEnd = (sigc::signal0<bool>*) data;
int r = opEnd->emit (); int r = opEnd->emit ();
delete opEnd; delete opEnd;
gdk_threads_leave (); //gdk_threads_leave ();
return r; return r;
} }
void workingThread () { void workingThread () {
if (!qMutex) /// if (!qMutex)
qMutex = new Glib::Mutex (); // qMutex = new Glib::Mutex ();
qMutex->lock(); // qMutex->lock();
retval = opStart.emit (); retval = opStart.emit ();
g_idle_add (ProgressConnector<T>::emitEndSignal, new sigc::signal0<bool> (opEnd)); g_idle_add (ProgressConnector<T>::emitEndSignal, new sigc::signal0<bool> (opEnd));
workThread = 0; // workThread = 0;
qMutex->unlock(); // qMutex->unlock();
} }
public: public:
@@ -110,7 +111,9 @@ class ProgressConnector {
if( !workThread ){ if( !workThread ){
opStart.connect (startHandler); opStart.connect (startHandler);
opEnd.connect (endHandler); opEnd.connect (endHandler);
workThread = Glib::Thread::create(sigc::mem_fun(*this, &ProgressConnector<T>::workingThread), 0, true, true, Glib::THREAD_PRIORITY_NORMAL); // rtengine::batchThread->yield();
workingThread();
// workThread = Glib::Thread::create(sigc::mem_fun(*this, &ProgressConnector<T>::workingThread), 0, true, true, Glib::THREAD_PRIORITY_NORMAL);
} }
if (qMutex) if (qMutex)