After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 164948 - GnomeApp is not robust against being created without gnome_program_init()
GnomeApp is not robust against being created without gnome_program_init()
Status: RESOLVED FIXED
Product: libgnomeui
Classification: Deprecated
Component: general
CVS HEAD
Other All
: Normal critical
: future
Assigned To: libgnomeui maintainers
libgnomeui maintainers
Depends on:
Blocks:
 
 
Reported: 2005-01-22 22:31 UTC by muppet
Modified: 2005-01-25 13:23 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
trivial fix. (835 bytes, patch)
2005-01-22 22:34 UTC, muppet
committed Details | Review

Description muppet 2005-01-22 22:31:06 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
Comment 1 muppet 2005-01-22 22:34:30 UTC
Created attachment 36393 [details] [review]
trivial fix.
Comment 2 Kjartan Maraas 2005-01-24 14:18:01 UTC
Looks simple enough, Anders is this ok to commit?
Comment 3 Anders Carlsson 2005-01-24 14:23:48 UTC
Yeah, looks good to me.
Comment 4 Kjartan Maraas 2005-01-25 13:22:54 UTC
Commited to both branches.