[svn:parrot] r48455 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Fri Aug 13 16:23:47 UTC 2010


Author: chromatic
Date: Fri Aug 13 16:23:46 2010
New Revision: 48455
URL: https://trac.parrot.org/parrot/changeset/48455

Log:
[PMC] Fixed segfaults in ImageIO PMC's destroy().

In certain (yet undiagnosed) cases, the "You can destroy the PackFile
attribute" flag is on but there's no PackFile attribute.  This makes C sad.
The culprit is r48447.

A better approach is to use PObj_custom_destroy_SET() only when it's okay to
destroy this attribute, but that fix will take longer.  In the meantime, this
works at the expense of a bit of extra work.

Modified:
   trunk/src/pmc/imageio.pmc

Modified: trunk/src/pmc/imageio.pmc
==============================================================================
--- trunk/src/pmc/imageio.pmc	Fri Aug 13 15:42:51 2010	(r48454)
+++ trunk/src/pmc/imageio.pmc	Fri Aug 13 16:23:46 2010	(r48455)
@@ -423,7 +423,7 @@
 
 */
     VTABLE void destroy() {
-        if (!PObj_flag_TEST(private2, SELF))
+        if (!PObj_flag_TEST(private2, SELF) && PARROT_IMAGEIO(SELF)->pf)
             PackFile_destroy(INTERP, PARROT_IMAGEIO(SELF)->pf);
         PARROT_IMAGEIO(SELF)->pf = NULL;
     }


More information about the parrot-commits mailing list