mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Fix a problem where several threads throwing exceptions could cause an abort().
This makes the infamous "This application has requested the Runtime to terminate it in an unusual way" message to go away.
This commit is contained in:
parent
67ca2ee1dd
commit
c33fa2c9cc
13
main.cc
13
main.cc
|
@ -19,6 +19,19 @@
|
|||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
// The following clause fixes a race in the MinGW runtime where throwing
|
||||
// exceptions for the first time in several threads simultaneously can cause
|
||||
// an abort(). This code throws first exception in a safe, single-threaded
|
||||
// manner, thus avoiding that race.
|
||||
{
|
||||
class Dummy {};
|
||||
|
||||
try
|
||||
{ throw Dummy(); }
|
||||
catch( Dummy )
|
||||
{}
|
||||
}
|
||||
|
||||
if ( argc == 3 && strcmp( argv[ 1 ], "--show-error-file" ) == 0 )
|
||||
{
|
||||
// The program has crashed -- show a message about it
|
||||
|
|
Loading…
Reference in a new issue