Gtk::Action subclass with Visual C


I created two Action subclasses (one for ScaleButton and another for ColorButton). It works fine on linux (Ubuntu 10.04 and Debian Sid). However it crashes with Visual C++ 2008.

My project uses stlport (to avoid DLL restrictions on the standard library) so I compiled libsigc++, glibmm, cairomm, pangomm, atkmm and gtkmm (2.22.0) with Stlport 5.2.1.

I isolated the problem (or at least, one problem) in a small code sample pasted at the end of the message. The program crashes (access violation) at exit in Gtk::Action::~Action(), which is an empty method !

Moreover, Visual C++'s debugger prints a wrong address for "this" whereas a "cout << this" in my destructor prints the good address.

Running the program with valgrind on linux displays no error.

Does anyone know what can cause such a crash ? It is hard to find documentation or examples on how to create custom actions, so I don't know if I did something wrong.

Many thanks,

#include <gtkmm.h>

class MyAction: public Gtk::Action
        static Glib::RefPtr<MyAction> create(const Glib::ustring &name)
            return Glib::RefPtr<MyAction>(new MyAction(name));
        MyAction(const Glib::ustring &name):
        ~MyAction() {}

int main(int argc, char* argv[])
    Gtk::Main kit(argc, argv);
    Gtk::Window w;
    Glib::RefPtr<MyAction> act(MyAction::create("toto"));;
    return 0;

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