[gtkmm] sigc::connection as member of widget



I had in my application sigc::connection as member of my class derived
from Gtk::Widget (not directly, there were some intermediate classes).
Value to it has been assigned to
   Glib::signal_timeout().connect(sigc::connection(*this,&some_member_function...),100)
All worked, while libsigc++-1.2.X were used (of course then SigC::Connection
were used instead). Upgrade to latest development versions of gtkmm
(now gtkmm-2.3.5. libsigc++-1.9.15) caused Glib critical error message or 
SIGSEGV in destructor.

I know that it's not really needed to save a connection in such case, unless I 
want to close it earlier before destructor, but anyway I think it should not 
crash.

From a simple test example (below) I'm getting following messages:
-----------------------------------------------------------------------
(foo:2236): Gtk-WARNING **: Ignoring the separator setting

(foo:2236): GLib-CRITICAL **: file gmain.c: line 997 (g_source_destroy): 
assertion `source != NULL' failed
-----------------------------------------------------------------------
In this case there were no SIGSEGV

From GDB I'm getting backtrace from 2nd call to g_log():

(gdb) where
#0  0x407c9ea3 in g_log () from /usr/lib/libglib-2.0.so.0
#1  0x407bf91e in g_source_destroy () from /usr/lib/libglib-2.0.so.0
#2  0x4064c183 in (anonymous namespace)::SourceConnectionNode::notify ()
   from /usr/lib/libglibmm-2.3.so.6
#3  0x4066b8c5 in sigc::internal::slot_rep::disconnect (this=0x0)
    at functors/slot_base.cc:37
#4  0x4066b902 in sigc::internal::slot_rep::notify (data=0x80b4f78)
    at functors/slot_base.cc:51
#5  0x4066b107 in ~trackable_callback_list (this=0x80a7970) at stl_list.h:167
#6  0x4066afa9 in sigc::trackable::notify_callbacks (this=0xbffff450)
    at trackable.cc:61
#7  0x4066aeac in ~trackable (this=0xbffff450) at trackable.cc:45
#8  0x0804c81d in main ()

Andris

-----------------------------------  example  -------------------------
#include <gtkmm/main.h>
#include <gtkmm/messagedialog.h>
#include <sigc++/sigc++.h>

void run_foo (void);

class foo : public Gtk::MessageDialog
{
    sigc::connection conn;
  public:
    foo (void) :
        Gtk::MessageDialog ("This is a test\n", false, Gtk::MESSAGE_INFO,
               Gtk::BUTTONS_OK, true, false )
    {
       Glib::signal_timeout().
        connect (sigc::mem_fun(*this, &foo::do_nothing),100)
        ;
    }

    bool do_nothing (void) { return true; }
};



int main (int argc, char ** argv)
{
  Gtk::Main kit(argc, argv);
  foo test;
  test.run();
  return 0;
}






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