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


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