CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   Error%7eerror triggers crash after handling exceptions thrown by errorexit twice (

7islands September 3, 2007 10:16

Description: The delete messa
The delete messageStreamPtr_; line in error::~error() triggers crash after handling *this object thrown in error::exit() twice if throwExceptions_ is set to true. I think this is because throw *this; in error::exit() actually throws a temporary bitwise copy of *this (even if the object is caught by reference), and the destructor of the temporary object deletes *messageStreamPtr_ of the static object FatalError or FatalIOError (which must not be deleted except when the application terminates). Thus, the first exception handling deletes *messageStreamPtr_, while the second one triggers crash trying to delete the already deleted *messageStreamPtr_.

All that sets FatalError.throwExceptions() and FatalIOError.throwExceptions().

Source file:

I'm not sure if you get the description above... I'll be posting a testcase if that is the case.




henry September 3, 2007 17:16

Thanks for the detailed bug re
Thanks for the detailed bug report. To fix this bug in OpenFOAM version 1.4.1 replace OpenFOAM-1.4.1/src/OpenFOAM/db/error/error.H with error.H , OpenFOAM-1.4.1/src/OpenFOAM/db/error/error.C with error.C and OpenFOAM-1.4.1/src/OpenFOAM/db/IOstreams/StringStreams/OStringStream.H with OStringStream.H and recompile the OpenFOAM library.

7islands September 4, 2007 05:24

Tried the fix with 1.4.1. It w
Tried the fix with 1.4.1. It works perfectly. Thanks!


All times are GMT -4. The time now is 08:11.