GNOME Bugzilla – Bug 164948
GnomeApp is not robust against being created without gnome_program_init()
Last modified: 2005-01-25 13:23:20 UTC
Please describe the problem: gnome_app_instance_init() passes the return value from gnome_program_get() straight to g_object_get() without checking for NULL. It is, of course, a programmer error to try to create a GnomeApp before calling gnome_program_init(), but if you're using a Glade file, libglade can load the gnome module on its own, and the learning programmer is left very confused by the trickle of assertions and eventual crash that result from adding a Gnome widget to your working gtk+ glade project. This is easily fixed by having the GnomeApp instance initializer abort with a helpful message if gnome_program_get() returns NULL. Steps to reproduce: 1. Create a glade application that uses a GnomeApp. 2. Create a perl program using Gtk2::GladeXML and Gtk2 without calling Gnome2::Program->init(). 3. Start the app -> crash. Actual results: Crash. Expected results: Helpful message. Does this happen every time? Other information: http://mail.gnome.org/archives/gtk-perl-list/2005-January/msg00160.html
Created attachment 36393 [details] [review] trivial fix.
Looks simple enough, Anders is this ok to commit?
Yeah, looks good to me.
Commited to both branches.