mirror of
https://github.com/ImageMagick/ImageMagick.git
synced 2026-05-31 11:18:42 +02:00
Stop throwing exceptions in destructors.
This commit is contained in:
+10
-3
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user