[gtkmm] Segfault when connecting Gtk::Action::signal_activate()



Hello,
I decided to learn some gtkmm, and I'm writing a notepad application to do
so. In it, I subclassed a window and add the layout from Gtk::Builder. Menu
and toolbar are connected to actions, which I then manually get from my
code and try to connect their signal_activate() to my handlers.

Except that I get a segfault when trying that. Here's the code:

[header]
Gtk::Action* pAc_new;

void on_ac_new();

[cpp]

[snip: make builder, add contents to window]
    ref_builder->get_widget("ac_new", pAc_new);
    pAc_new->signal_activate().connect( sigc::mem_fun(*this,
&NotepadWindow::on_ac_new) );
[later:]
void NotepadWindow::on_ac_new ()
{
[snip]

AFAIK this should work, but then again, I'm new to gtkmm and libsigc++.

Also, I noticed you can't get Gtk::Action from Builder, since it prints an
error in console. Is that is? If so, how do I fix it?

Thanks,
Filip


-- 
_____________________
Filip Lamparski - FB <https://www.facebook.com/filip.lamparski> -
G+<https://plus.google.com/105688569486178456264/posts>



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