Hi,

This patch fixes build with older Boost version (< 1.36). In particular, intrusive_ptr<>::reset(T *) appeared in 1.35 and intrusive_ptr<>::reset() appeared in 1.36.

I have only copied the implementation from boost 1.36. Not tested.

Regards,
Gwenole.
From 1338de1ea21d84114dc89e853e1d674e9672ae67 Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne <gbeauche...@splitted-desktop.com>
Date: Thu, 5 Aug 2010 12:35:49 +0200
Subject: [PATCH] Fix build with older Boost version (< 1.36).

---
 libcore/asobj/flash/display/BitmapData_as.cpp |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp b/libcore/asobj/flash/display/BitmapData_as.cpp
index 2da403b..996abd4 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -79,6 +79,25 @@ namespace {
 
 }
 
+static inline void reset(boost::intrusive_ptr<CachedBitmap> &lhs,
+                         CachedBitmap *rhs = 0)
+{
+    if (rhs) {
+#if BOOST_VERSION < 103500 /* 1.35.0 */
+        boost::intrusive_ptr<CachedBitmap>(rhs).swap(lhs);
+#else
+        lhs.reset(rhs);
+#endif
+    }
+    else {
+#if BOOST_VERSION < 103600 /* 1.36.0 */
+        boost::intrusive_ptr<CachedBitmap>().swap(lhs);
+#else
+        lhs.reset();
+#endif
+    }
+}
+
 BitmapData_as::BitmapData_as(as_object* owner, std::auto_ptr<GnashImage> im,
         boost::uint32_t fillColor)
     :
@@ -92,7 +111,7 @@ BitmapData_as::BitmapData_as(as_object* owner, std::auto_ptr<GnashImage> im,
     
     // If there is a renderer, cache the image there, otherwise we store it.
     Renderer* r = getRunResources(*_owner).renderer();
-    if (r) _cachedBitmap.reset(r->createCachedBitmap(im));
+    if (r) reset(_cachedBitmap, r->createCachedBitmap(im));
     else _image.reset(im.release());
 }
     
@@ -194,7 +213,7 @@ void
 BitmapData_as::dispose()
 {
     if (_cachedBitmap) _cachedBitmap->dispose();
-    _cachedBitmap.reset();
+    reset(_cachedBitmap);
     _image.reset();
     updateObjects();
 }
-- 
1.5.4.3

_______________________________________________
Gnash-dev mailing list
Gnash-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to