[svn:parrot] r48478 - branches/gc_threshold_tuning/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat Aug 14 00:32:49 UTC 2010


Author: chromatic
Date: Sat Aug 14 00:32:49 2010
New Revision: 48478
URL: https://trac.parrot.org/parrot/changeset/48478

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:
   branches/gc_threshold_tuning/src/pmc/imageio.pmc

Modified: branches/gc_threshold_tuning/src/pmc/imageio.pmc
==============================================================================
--- branches/gc_threshold_tuning/src/pmc/imageio.pmc	Sat Aug 14 00:32:46 2010	(r48477)
+++ branches/gc_threshold_tuning/src/pmc/imageio.pmc	Sat Aug 14 00:32:49 2010	(r48478)
@@ -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