Re: Why this code doesn't work?
- From: codekiddy <codekiddy gmail com>
- To: Kjell Ahlstedt <kjell ahlstedt bredband net>
- Cc: Gtkmm List <gtkmm-list gnome org>
- Subject: Re: Why this code doesn't work?
- Date: Tue, 22 Dec 2015 01:36:07 +0100
Hey guys I solved all the issues and would like to share my findings!!
Recently I made several posts here on gtkmm-list having problems with GTKMM on Windows with msvc builds, so as if
#define GTKMM_ATKMM_ENABLED is defined during compilation there will be a runtime crash and
destruction problem with Glib::RefPtr<Pango::Layout> layout;
The problem was that I compiled ATKMM and PANGOMM with /vd2 compiler switch, and that was causing program shutdown crash in Atk::~Implementor and Layout::~Layout
I recompiled these 2 without the /vd2 option and with GTKMM_ATKMM_ENABLED 1, now everything works just fine :D
I copied a simple test program from stackoverflow to test dynamic_cast operator
struct Base :
virtual public Glib::Object
{
Base() :Object()
{
// upcast and downcast
Object* o = static_cast<Object*>(this);
Base* b = dynamic_cast<Base*>(o);
std::cout << " this: " << this << " after cast: " << b;
// should be the same address
if (this != b)
std::cout << " check address: NOK";
else
std::cout << " check address: OK ";
}
};
struct Derived : public Base
{
int i;
};
int main()
{
Derived d;
std::cout << " end arrived: ";
std::stringstream* ss = new std::stringstream;
delete ss;
std::cout << "OK";
std::cin.get();
return 0;
}
And here is a program output after running a test:
(test_dynamic_cast.exe:10464): GLib-GObject-CRITICAL **: g_object_set_qdata_full: assertion 'quark > 0' failed
this: 0067F74C after cast: 0067F750 check address: NOK end arrived: OK
what do you think? is this output OK? obviously the cast was successful in the end, even though glib gives CRITICAL message in beginning.
There was no crash! :D YES!
PS. Kjell, thanks a lot for your test results, that was make me review my VS projects from scratch!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]