Yes, you are right, dynamic_cast is unrelated to the problem, the real reason 
is get_widget_checked 
code, see my answer to Alexander Shaduri.

-----Original Message-----
From: Armin Burgmeier <[email protected]>
To: Саша Иваненко <[email protected]>
Date: Tue, 21 Jul 2009 10:53:52 -0400
Subject: Re: Can't process Gtk::Builder::get_widget errors

> Саша Иваненко wrote:
> > Hi all
> > 
> > I use Gtk::Builder to load UIs from glade-generated xml on win32(Visual 
> > Studio 9.0). 
> > Problem is what if widget with a given name does not exist get_widget 
> > generates access violation 
system 
> > exception, without any chance for me to catch it. All I can do is to check 
> > widget existence using 
gtk+ 
> > native gtk_builder_get_object call before calling Builder::get_widget. As 
> > far as I understand the 
root of 
> > the problem is what get_widget_checked internal call returns 0, and 
> > dynamic_cast from 0 throws AV 
instead 
> > of casting to 0 ( or throwing bad_cast?). 
> 
> Are you sure that dynamic_cast crashes when casting from 0? This seems 
> to work for me in this testcase:
> 
> #include <iostream>
> 
> class A { virtual ~A(); };
> class B: public A {};
> 
> int main()
> {
>    std::cout << dynamic_cast<B*>((A*)NULL) << std::endl;
> }
> 
> > Is it Win32 specific problem? Ho do the get_widget is intended to behave in 
> > case of non-existent 
widget 
> > name? I would appreciate any suggestions.
> > 
> > Thank you,
> > Alexander Ivanenko.
> 
> Armin
> 

_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to