FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug in gtk.Bin.getChild() ?

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
brianhsu



Joined: 17 Jan 2007
Posts: 9
Location: Taiwan

PostPosted: Thu May 31, 2007 9:54 am    Post subject: Bug in gtk.Bin.getChild() ? Reply with quote

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
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Thu May 31, 2007 10:37 pm    Post subject: Re: Bug in gtk.Bin.getChild() ? Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group