Stop throwing exceptions in destructors.

This commit is contained in:
Dirk Lemstra
2017-02-09 22:33:18 +01:00
parent 1503d3b2af
commit 459249f2fc
3 changed files with 22 additions and 17 deletions
+10 -3
View 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;
}
+9 -3
View 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;
}
+3 -11
View 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
}