=?koi8-r?Q?Re[2]=3A_Can't_process_Gtk=3A=3ABuilder=3A=3Aget=5Fwidget_errors?=



Yes, it seems like the bug your mention is the bug I have encountered. However, it is non only 
documentation bug: get_widget does not throw anything, it just crashes. I have investigated the problem  
some further, dynamic_cast turned out to be unrelated to the crash, the reason lies in the 
get_widget_checked code :


Gtk::Widget* Builder::get_widget_checked(const Glib::ustring& name, GType type)
{
  // Get the widget from the GtkBuilder file.

  GtkWidget *cobject = get_cwidget(name); 

  --------> cobject is NULL now 

  // Check if it has the correct type.

  --------> and G_OBJECT_TYPE(cobject) crashes(access violation on Win32)! 

  if(!g_type_is_a(G_OBJECT_TYPE(cobject), type))  
  {
    g_critical("gtkmm: widget `%s' (in GtkBuilder file) is of type `%s' but `%s' was expected",
               name.c_str(), G_OBJECT_TYPE_NAME(cobject), g_type_name(type));
    return 0;
  }

  return Glib::wrap (GTK_WIDGET (cobject), true /* take ref */);
}

So, there is no way to process get_widget errors. I seems like a critical bug for me.

Thank you,
Alexander Ivanenko.

-----Original Message-----
From: Alexander Shaduri <ashaduri gmail com>
To: Саша Иваненко <kitovyj mail ru>
Date: Tue, 21 Jul 2009 14:03:26 +0400
Subject: Re: Can't process Gtk::Builder::get_widget errors

> 
> Hello,
> 
> On Tue, 21 Jul 2009 13:55:04 +0400
> Саша Иваненко <kitovyj mail ru> wrote:
> 
> > 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?). 
> > 
> > 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.
> 
> I think you are refering to the bug I reported a while ago:
> http://bugzilla.gnome.org/show_bug.cgi?id=548022
> 
> It seems to have been renamed to "documentation" issue, which is incorrect.
> 
> Thanks,
> Alexander
> 



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