From: Dirk Lemstra Date: Thu, 9 Feb 2017 21:33:18 +0000 (+0100) Subject: Stop throwing exceptions in destructors. X-Git-Tag: 7.0.4-8~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=459249f2fcb238e0aceca7531ea952e7018dca23;p=imagemagick Stop throwing exceptions in destructors. --- diff --git a/Magick++/lib/Blob.cpp b/Magick++/lib/Blob.cpp index 7863b0d9b..d948e1ffa 100644 --- a/Magick++/lib/Blob.cpp +++ b/Magick++/lib/Blob.cpp @@ -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 @@ -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; } diff --git a/Magick++/lib/Image.cpp b/Magick++/lib/Image.cpp index 9a939cdf1..34a367b8d 100644 --- a/Magick++/lib/Image.cpp +++ b/Magick++/lib/Image.cpp @@ -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; } diff --git a/Magick++/lib/Thread.cpp b/Magick++/lib/Thread.cpp index cb309d5af..b89e9b8bf 100644 --- a/Magick++/lib/Thread.cpp +++ b/Magick++/lib/Thread.cpp @@ -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 }