Does destroying GtkBuilder destroy all created widgets?
Question regarding GtkBuilder. When we unref builder pointer does it destroys all the screens/widgets the builder had created?
if( builder_ptr )
g_object_unref(G_OBJECT(builder_ptr));
Suppose we have created one screen using Glade/XML with some 2开发者_JAVA百科-3 top_level windows in it
gtk_builder_add_from_file(builder_ptr, "Test.glade", &error )
and generated GtkBuilder pointer (as above) so after deleting this pointer does it deletes created Windows or do we need to manually delete these windows?
Thanks,
PP.From the documentation:
A GtkBuilder holds a reference to all objects that it has constructed and drops these references when it is finalized. This finalization can cause the destruction of non-widget objects or widgets which are not contained in a toplevel window. For toplevel windows constructed by a builder, it is the responsibility of the user to call gtk_widget_destroy() to get rid of them and all the widgets they contain.
So, no, GtkBuilder does not do this for you, you have to do it yourself.
精彩评论