[perl-Cairo] Cairo::Path: prevent crashes on exit with perl 5.6



commit 20c47405ea3f24410011c9c8db42a33083f0c32a
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Sat Aug 18 17:00:05 2012 +0200

    Cairo::Path: prevent crashes on exit with perl 5.6

 CairoPath.xs |   33 +++++++++++++++++++++++++++++++++
 NEWS         |    5 +++++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/CairoPath.xs b/CairoPath.xs
index 227a88a..f9c7402 100644
--- a/CairoPath.xs
+++ b/CairoPath.xs
@@ -323,6 +323,17 @@ SV * FETCH (cairo_path_t * path, IV index)
 
 MODULE = Cairo::Path	PACKAGE = Cairo::Path::Data
 
+#if PERL_REVISION <= 5 && PERL_VERSION <= 6
+
+void DESTROY (SV * sv)
+    CODE:
+	/* Unset mg_ptr to prevent perl 5.6.x from trying to free it. */
+	MAGIC *mg = cairo_perl_mg_find (SvRV (sv), PERL_MAGIC_ext);
+	if (mg)
+		mg->mg_ptr = NULL;
+
+#endif /* 5.6.x */
+
 SV * FETCH (SV * sv, const char * key)
     PREINIT:
 	cairo_path_data_t * data;
@@ -387,6 +398,17 @@ const char * NEXTKEY (sv, const char * lastkey)
 
 MODULE = Cairo::Path	PACKAGE = Cairo::Path::Points
 
+#if PERL_REVISION <= 5 && PERL_VERSION <= 6
+
+void DESTROY (SV * sv)
+    CODE:
+	/* Unset mg_ptr to prevent perl 5.6.x from trying to free it. */
+	MAGIC *mg = cairo_perl_mg_find (SvRV (sv), PERL_MAGIC_ext);
+	if (mg)
+		mg->mg_ptr = NULL;
+
+#endif /* 5.6.x */
+
 IV FETCHSIZE (SV * sv)
     PREINIT:
 	cairo_path_data_t * data;
@@ -435,6 +457,17 @@ SV * STORE (SV * sv, IV index, SV * value)
 
 MODULE = Cairo::Path	PACKAGE = Cairo::Path::Point
 
+#if PERL_REVISION <= 5 && PERL_VERSION <= 6
+
+void DESTROY (SV * sv)
+    CODE:
+	/* Unset mg_ptr to prevent perl 5.6.x from trying to free it. */
+	MAGIC *mg = cairo_perl_mg_find (SvRV (sv), PERL_MAGIC_ext);
+	if (mg)
+		mg->mg_ptr = NULL;
+
+#endif /* 5.6.x */
+
 IV FETCHSIZE (sv)
     CODE:
 	RETVAL = 2;
diff --git a/NEWS b/NEWS
index bd94771..fbca3b3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Overview of changes in Cairo <next>
+==================================
+
+* Prevent crashes on exit with Cairo::Path on perl 5.6.
+
 Overview of changes in Cairo 1.101
 ==================================
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]