Re: Gtk::Action subclass with Visual C
- From: Yann LEYDIER <yann leydier info>
- To: gtkmm-list gnome org
- Subject: Re: Gtk::Action subclass with Visual C
- Date: Mon, 31 Jan 2011 17:03:10 +0100
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 ?
Thanks,
yann
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 ?
yann
On 19/01/2011 16:35, Yann LEYDIER wrote:
Hi,
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,
Yann
#include <gtkmm.h>
class MyAction: public Gtk::Action
{
public:
static Glib::RefPtr<MyAction> create(const Glib::ustring &name)
{
return Glib::RefPtr<MyAction>(new MyAction(name));
}
private:
MyAction(const Glib::ustring &name):
Gtk::Action(name)
{
}
~MyAction() {}
};
int main(int argc, char* argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window w;
Glib::RefPtr<MyAction> act(MyAction::create("toto"));
kit.run(w);
return 0;
}
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]