Hello:
I'm using a thread and a dispatcher to call a function that loads some
shared objets at the same time that the main window is build (showed).
This code works fine normally but if produces a segmentation fault if I
ltrace the binary ... why ??
Is this the good way to use the thread and dispatcher? i've read the
examples in gtkmm documentation and I think the code is ok.
Now the code and the last part of the ltrace:
------------------------ The Code
... This is the end of Gtk::Window constructor
dispatcher.connect(
sigc::mem_fun(*this, &MainWindow::init) );
Glib::Thread* thread = Glib::Thread::create(
sigc::mem_fun(*this, &MainWindow::call_dispatcher), false);
// Muestra todos los widgets
show_all_children();
}
MainWindow::~MainWindow()
{
}
void MainWindow::call_dispatcher()
{
dispatcher();
}
void MainWindow::init()
{
// Espera a q terminen todos los eventos de gtk
while( Gtk::Main::events_pending() )
Gtk::Main::iteration();
// Busca y carga los plugins
mainStatusBar->push("Cargando plugins"); // ??
guiPluginManager->scan_plugins();
for(int i = 0; i < guiPluginManager->size(); i++){
PluginNode* pluginNode =
guiPluginManager->get_plugin_node(i);
actionList->add_plugin(pluginNode, i);
}
}
-----------------
----------------- Last part of ltrace
<... Gnome::UI::App::set_statusbar(Gtk::Widget&) resumed> ) = 1
Glib::ustring::ustring(char const*)(0xbffff590, 0x80b2978, 0x8161908,
0xbffff5a0, 0xb760703c) = 0xbffff590
Glib::ustring::~ustring()(0xbffff590, 0x80b2978, 0x8161908, 0xbffff5a0,
0xb760703c) = 0
operator new(unsigned int)(40, 0x80b2978, 0x8161908, 0xbffff5a0,
0xb760703c) = 0x81a7628
sigc::trackable::trackable()(0x81a7628, 0x80b2978, 0x8161908,
0xbffff5a0, 0x160703c) = 0x81a7628
sigc::trackable::add_destroy_notify_callback(void*, void* (*)(void*))
const(0xbffff664, 0x81a7628, 0x80771dc, 0x4148b6be, 40) = 0xbffff390
sigc::slot_base::slot_base(sigc::internal::slot_rep*)(0xbffff450,
0x81a7628, 0x8161908, 0xbffff5a0, 0x60703c) = 0x81a7628
Glib::Dispatcher::connect(sigc::slot<void, sigc::nil, sigc::nil,
sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>
const&)(0xbffff460, 0xbffff644, 0xbffff450, 0xbffff5a0, 0x60703c
<unfinished ...>
operator new(unsigned int)(40, 5, 0xbffff2f0, 0xb74f9ab1, 0x41162547) =
0x81a7810
sigc::trackable::trackable()(0x81a7810, 5, 0xbffff2f0, 0xb74f9ab1,
0x41162547) = 0x81a7810
sigc::trackable::add_destroy_notify_callback(void*, void* (*)(void*))
const(0xbffff664, 0x81a7810, 0x80771dc, 0x4148b6be, 40) = 0xbffff230
<... Glib::Dispatcher::connect(sigc::slot<void, sigc::nil, sigc::nil,
sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil> const&)
resumed> ) = 0xbffff460
sigc::connection::~connection()(0xbffff460, 0xbffff644, 0xbffff450,
0xbffff5a0, 0x60703c) = 0xbffff360
sigc::slot_base::~slot_base()(0xbffff450, 0xbffff644, 0xbffff450,
0xbffff5a0, 0x60703c <unfinished ...>
sigc::trackable::remove_destroy_notify_callback(void*) const(0xbffff664,
0x81a7628, 0xbffff3c8, 0xb755c07e, 0x81a7840) = 0xbffff330
<... sigc::slot_base::~slot_base() resumed> ) = 0x41132af8
operator new(unsigned int)(40, 0xbffff644, 0xbffff450, 0xbffff5a0,
0x60703c) = 0x81a7628
sigc::trackable::trackable()(0x81a7628, 0xbffff644, 0xbffff450,
0xbffff5a0, 94268) = 0x81a7628
sigc::trackable::add_destroy_notify_callback(void*, void* (*)(void*))
const(0xbffff664, 0x81a7628, 0x80771dc, 0x4148b6be, 40) = 0xbffff390
sigc::slot_base::slot_base(sigc::internal::slot_rep*)(0xbffff450,
0x81a7628, 0xbffff450, 0xbffff5a0, 28732) = 0x81a7628
Glib::Thread::create(sigc::slot<void, sigc::nil, sigc::nil, sigc::nil,
sigc::nil, sigc::nil, sigc::nil, sigc::nil> const&, bool)(0xbffff450, 0,
0xbffff450, 0xbffff5a0, 28732 <unfinished ...>
operator new(unsigned int)(40, 0xbffff5f0, 0xbffff3c8, 0x4148b6be, 8) =
0x81a7860
sigc::trackable::trackable()(0x81a7860, 0xbffff5f0, 0xbffff3c8,
0x4148b6be, 8) = 0x81a7860
sigc::trackable::add_destroy_notify_callback(void*, void* (*)(void*))
const(0xbffff664, 0x81a7860, 0x80771dc, 0x4148b6be, 40) = 0xbffff310
Han ocurrido múltiples errores de segmentación; no se puede mostrar el
diálogo de error
+++ exited (status 1) +++
---------------------------------------------
Thanks in advance :)
--
-----------------------------------
Diego Fdez. Durán <diego goedi net>
Web: http://www.goedi.net
GPG ID: 90D266BB
-----------------------------------
Attachment:
signature.asc
Description: This is a digitally signed message part