View previous topic :: View next topic |
Author |
Message |
brianhsu
Joined: 17 Jan 2007 Posts: 9 Location: Taiwan
|
Posted: Thu May 31, 2007 9:54 am Post subject: Bug in gtk.Bin.getChild() ? |
|
|
Accoriding to GTK+ API, if a GtkBin has no child widget, then gtk_bin_get_child() should return null.
But I looked gtk.Bin, the getChild() method will always create an Widget object even when the GTK+ return null.
Code: |
public Widget getChild()
{
// GtkWidget* gtk_bin_get_child (GtkBin *bin);
return new Widget( gtk_bin_get_child(gtkBin) );
}
|
I believe this should be a bug. So here is my simple path.
Code: |
public Widget getChild()
{
// GtkWidget* gtk_bin_get_child (GtkBin *bin);
GtkWidget * widget = gtk_bin_get_child();
if ( widget )
return new Widget(widget);
} else {
return null;
}
}
|
Another question is that reasonable the gtk.Widget could create from null pointer? I found that the constructor of gtk.Widget seems doesn't check weather GtkWidget * is null or not. |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Thu May 31, 2007 10:37 pm Post subject: Re: Bug in gtk.Bin.getChild() ? |
|
|
brianhsu wrote: | Accoriding to GTK+ API, if a GtkBin has no child widget, then gtk_bin_get_child() should return null.
|
thanks! I added it to the wrapper (to be tested).
brianhsu wrote: |
Another question is that reasonable the gtk.Widget could create from null pointer? I found that the constructor of gtk.Widget seems doesn't check weather GtkWidget * is null or not. |
It should throw an exception, I'll add it.
Or should it be an assert?
I'll do the assert until someone complains.
Ant |
|
Back to top |
|
|
|