GNOME Bugzilla – Bug 323891
pygimp crashes python when accessing PDB
Last modified: 2008-01-15 14:05:10 UTC
From Debian bug report http://bugs.debian.org/342850 (even if this is not a valid operation, it shouldn't crash python): $ PYTHONPATH=/usr/lib/gimp/2.0/python/ python Python 2.3.5 (#2, Nov 20 2005, 16:40:39) [GCC 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>>>> import gimpfu; >>>>>> dir(gimpfu.pdb) (process:1998): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed LibGimpBase-ERROR **: could not find handler for message: 5 aborting... [1] 13924 abort (core dumped) PYTHONPATH=/usr/lib/gimp/2.0/python/ python ------- In case the coredump is of any importance at all: (gdb) bt
+ Trace 64565
That's what you get for using the wire protocol without initializing it beforehand.
"Doctor, it hurts when I do this." "Well, don't do that anymore then." You can't use any of the gimp functions outside of the environment that the gimp app runs plug-ins in. That's partially why the pygimp stuff is *not* installed into the global python module paths. I don't think preventing this edge case from happening is worth cluttering every entry point into the pygimp code with a check for whether the environment is right or not. It may be possible to do some sanity checks upon import, but I'm not convinced that'd be correct for all usage. Note that this is an explict abort(), and not a random crash. There's other extension modules for libraries that may call abort() in bogus user configurations, so the "don't crash" assertion is debatable. Leaving this open for now, since it may be possible to be more graceful, but I may WONTFIX this upon more pondering.
Yosh, what do you think about this now? In my opinion it's OK to abort here. Perhaps we should add a check for wire_ht != NULL to the wire functions in libgimpbase and g_error() with a more useful error message?
I've improved the error checking in libgimpbase. Closing the report as WONTFIX. 2007-06-25 Sven Neumann <sven@gimp.org> * libgimpbase/gimpwire.c: if the wire protocol is used without prior initialization, abort with g_error() instead of crashing.