Forward-port 86a5cdbe6ddb3506515cf8585a0902937147862e from master; crash when repeati...
authorCarl Hetherington <cth@carlh.net>
Tue, 24 Feb 2015 22:58:38 +0000 (22:58 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 24 Feb 2015 22:58:38 +0000 (22:58 +0000)
src/lib/magick_image_proxy.cc
src/lib/magick_image_proxy.h

index e4417f3665e85d0e15163bd0ffccde7b1fa2f23b..d4d7e8aa6b8690a2c8945b5fae5111b3fc4c4b35 100644 (file)
@@ -66,6 +66,8 @@ MagickImageProxy::MagickImageProxy (shared_ptr<cxml::Node>, shared_ptr<Socket> s
 shared_ptr<Image>
 MagickImageProxy::image (optional<dcp::NoteHandler>) const
 {
+       boost::mutex::scoped_lock lm (_mutex);
+       
        if (_image) {
                return _image;
        }
index 7d2251aebb491408aa3096eef8a8bb227943f62c..f4ddb2c9418c7c7d23f4c1e0c254a48aa1a043aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
 */
 
 #include "image_proxy.h"
+#include <boost/thread/mutex.hpp>
 
 class MagickImageProxy : public ImageProxy
 {
@@ -33,4 +34,5 @@ public:
 private:       
        Magick::Blob _blob;
        mutable boost::shared_ptr<Image> _image;
+       mutable boost::mutex _mutex;
 };