[gtkmm] glib::thread_init() segfault at startup



Hello,

I've got a gtkmm application where I'm trying to use threads.  Based on some
earlier discussion on this mailing list, it seems the preferred method of using
threads in a gtkmm app is to use the Glib::Thread system rather than manually
using pthreads.

My issue is I get a segfault as soon as I call Glib::thread_init(). I do believe
I am passing the correct libs and cflags to g++, as I used:
pkg-config gtkmm-2.0 --cflags --libs gthread

If I comment out the Glib::thread_init(), the app runs fine.  Any suggestions?

Code:
-------
#include <gtkmm/main.h>
#include <glibmm/thread.h>
#include "main_window.h"  

int main (int argc, char *argv[])
{
   if(!Glib::thread_supported())
      Glib::thread_init();

   Gtk::Main kit(argc, argv);
   MainWindow vsa_gui;

   // Install a one-shot idle handler to launch the threads
   // right after the main window has been displayed.
  
Glib::signal_idle().connect(SigC::bind_return(SigC::slot(vsa_gui,&MainWindow::launch_threads),
false));

   Gtk::Main::run(vsa_gui); //Shows the window and returns when it is closed.
   return 0;
}

-- 
Gene Ruebsamen


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]