Re: Gtk::Action subclass with Visual C

Good news : the crash is not caused by stlport !

I recompiled all sigc, Glibmm, Cairomm, etc. and Gtkmm with regular MS STL and the sample code still crashes in ~Action().

When debugger displays the value of "this", it is 12 bytes farther than the adress of my object (on a 32bits OS). There seems to be a kind of shift.

Using a virtual inheritence seems to help with the destructor crash problem but makes it impossible to cast MyAction* safely to Action*.

Playing with Glib::Object_base's constructor's parameters does not help (at best is can move the crash to sigc::trackable::~trackable !).

What strikes me is that inheritence works perfectly with Widgets ! Did I miss something ? Are there some flags that I should set manually appart from GTKMM_DLL ?


On 31/01/2011 11:52, Yann LEYDIER wrote:
I tried to run the same test with Gtkmm's installer and Visual C++ 2008
and it works. It also works with MinGW.

So it seems that Gtkmm cannot be compiled with Stlport. Any idea why ?

As Glib::ustring is based on std::string, I fear that if it is very
risky to link the official Gtkmm DLL with an exe that uses Stlport...
Did anyone try ?


On 19/01/2011 16:35, Yann LEYDIER wrote:

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;

gtkmm-list mailing list
gtkmm-list gnome org

gtkmm-list mailing list
gtkmm-list gnome org

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