]> granicus.if.org Git - imagemagick/commitdiff
Stop throwing exceptions in destructors.
authorDirk Lemstra <dirk@git.imagemagick.org>
Thu, 9 Feb 2017 21:33:18 +0000 (22:33 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Thu, 9 Feb 2017 21:33:18 +0000 (22:33 +0100)
Magick++/lib/Blob.cpp
Magick++/lib/Image.cpp
Magick++/lib/Thread.cpp

index 7863b0d9b8d9758369d56f626c44650d332156b6..d948e1ffae50889b5d6066fa5925c196912dc2e9 100644 (file)
@@ -1,7 +1,7 @@
 // This may look like C code, but it is really -*- C++ -*-
 //
 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2004
-// Copyright Dirk Lemstra 2013-2015
+// Copyright Dirk Lemstra 2013-2017
 //
 // Implementation of Blob
 //
@@ -12,6 +12,7 @@
 #include "Magick++/Include.h"
 #include "Magick++/Blob.h"
 #include "Magick++/BlobRef.h"
+#include "Magick++/Exception.h"
 
 #include <string.h>
 
@@ -34,8 +35,14 @@ Magick::Blob::Blob(const Magick::Blob& blob_)
 
 Magick::Blob::~Blob()
 {
-  if (_blobRef->decrease() == 0)
-    delete _blobRef;
+  try
+  {
+    if (_blobRef->decrease() == 0)
+      delete _blobRef;
+  }
+  catch(Magick::Exception)
+  {
+  }
 
   _blobRef=(Magick::BlobRef *) NULL;
 }
index 9a939cdf15a1f59896144c5a508aec80ce7eef41..34a367b8df149e06c5df63b6a2f055fe14e05e4b 100644 (file)
@@ -1,7 +1,7 @@
 // This may look like C code, but it is really -*- C++ -*-
 //
 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
-// Copyright Dirk Lemstra 2013-2016
+// Copyright Dirk Lemstra 2013-2017
 //
 // Implementation of Image
 //
@@ -265,8 +265,14 @@ Magick::Image::Image(const std::string &imageSpec_)
 
 Magick::Image::~Image()
 {
-  if (_imgRef->decrease() == 0)
-    delete _imgRef;
+  try
+  {
+    if (_imgRef->decrease() == 0)
+      delete _imgRef;
+  }
+  catch(Magick::Exception)
+  {
+  }
 
   _imgRef=(Magick::ImageRef *) NULL;
 }
index cb309d5af682738aaefdfc95f62d2da415fe46c3..b89e9b8bf022b6afe56343d2e7b79c7265a8ea6a 100644 (file)
@@ -1,7 +1,7 @@
 // This may look like C code, but it is really -*- C++ -*-
 //
 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002
-// Copyright Dirk Lemstra 2014-2015
+// Copyright Dirk Lemstra 2014-2017
 //
 // Implementation of thread support
 //
@@ -65,18 +65,10 @@ Magick::MutexLock::MutexLock(void)
 Magick::MutexLock::~MutexLock(void)
 {
 #if defined(MAGICKCORE_HAVE_PTHREAD)
-  int
-    sysError;
-
-  if ((sysError=::pthread_mutex_destroy(&_mutex)) == 0)
-    return;
-  throwExceptionExplicit(MagickCore::OptionError,"mutex destruction failed",
-    strerror(sysError));
+  (void) ::pthread_mutex_destroy(&_mutex);
 #endif
 #if defined(_MT) && defined(_VISUALC_)
-  if (::CloseHandle(_mutex) != 0)
-    return;
-  throwExceptionExplicit(MagickCore::OptionError,"mutex destruction failed");
+  (void) ::CloseHandle(_mutex);
 #endif
 }