Re: Gtk::Action subclass with Visual C

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

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