> > The function gimp-drawable-type-with-alpha wasn't
> > completely guarded. Calling it with a non-existent
> > drawable would cause a crash.

The fact that you can feed gimp with a bad drawable through the PDB and
make it crash, is indeed a bug. I have looked into the code in 
app/drawable_cmds.c and I wonder why the validity of the passed 
drawable_ID is not always checked. This code is autogenerated and it
looks that the check is disabled by default and is only enabled for
a few of gimp_drawable_ PDB calls. 

Yosh, is this intentional? Otherwise please apply the attached patch
which makes all PDB calls check the validity of the drawable_ID.


Salut, Sven



Index: drawable.pdb
===================================================================
RCS file: /cvs/gnome/gimp/tools/pdbgen/pdb/drawable.pdb,v
retrieving revision 1.19
diff -u -r1.19 drawable.pdb
--- drawable.pdb	1999/12/26 07:54:39	1.19
+++ drawable.pdb	2000/01/31 17:35:00
@@ -20,13 +20,11 @@
 sub drawable_arg {{
     name => 'drawable',
     type => 'drawable',
-    desc => 'The drawable',
-    no_success => 1
+    desc => 'The drawable'
 }}
 
 sub drawable_coord_args {
     @inargs = ( &drawable_arg );
-    delete $inargs[0]->{no_success};
 
     foreach (qw(x y)) {
 	push @inargs, { name => "${_}_coord", type => '0 <= int32',
@@ -104,7 +102,6 @@
         { name => 'undo', type => 'boolean',
 	  desc => 'Push merge to undo stack?' }
     );
-    delete $inargs[0]->{no_success};
 
     %invoke = ( code => 'drawable_merge_shadow (drawable, undo);' );
 }
@@ -130,7 +127,6 @@
 	{ name => 'fill_type', type => 'enum GimpFillType',
 	  desc => 'The type of fill: %%desc%%' }
     );
-    delete $inargs[0]->{no_success};
 
     %invoke = ( code => 'drawable_fill (drawable, (GimpFillType) fill_type);' );
 }
@@ -214,8 +210,6 @@
     $outargs[0]->{desc} = "The drawable's image";
     $outargs[0]->{init} = 1;
 
-    delete $inargs[0]->{no_success};
-
     %invoke = (
 	code => 'success = (gimage = drawable_gimage (drawable)) != NULL;'
     );
@@ -226,8 +220,6 @@
 
     &drawable_prop_proc("the drawable's type", 'type', 'enum GimpImageType',
 			'type', "The drawable's type: { %%desc%% }");
-
-    delete $inargs[0]->{no_success};
 }
 
 sub drawable_has_alpha {
@@ -425,7 +417,6 @@
 	&drawable_arg,
 	&std_image_arg
     );
-    delete $inargs[0]->{no_success};
 
     %invoke = ( code => 'gimp_drawable_set_gimage (drawable, gimage);' );
 }
@@ -461,7 +452,6 @@
 	  desc => 'The thumbnail height',
 	  alias => 'req_height' }
     );
-    delete $inargs[0]->{no_success};
 
     @outargs = (
 	&dim_args,

Reply via email to