Skip to content

Commit

Permalink
Backported fix for CORE-3259: Deadlock and sefgault when processing c…
Browse files Browse the repository at this point in the history
…trl-C in user code
  • Loading branch information
AlexPeshkoff committed Nov 25, 2010
1 parent 4177460 commit a1ccc9d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/jrd/cvt.cpp
Expand Up @@ -367,7 +367,7 @@ GDS_TIMESTAMP CVT_get_timestamp(const dsc* desc)
}


EngineCallbacks EngineCallbacks::instance;
Firebird::GlobalPtr<EngineCallbacks> EngineCallbacks::instance;


bool EngineCallbacks::transliterate(const dsc* from, dsc* to, CHARSET_ID& charset2)
Expand Down
5 changes: 3 additions & 2 deletions src/jrd/cvt_proto.h
Expand Up @@ -24,6 +24,7 @@
#ifndef JRD_CVT_PROTO_H
#define JRD_CVT_PROTO_H

#include "../common/classes/init.h"
#include "../common/cvt.h"
#include "../jrd/err_proto.h"

Expand All @@ -44,7 +45,7 @@ namespace Jrd
{
}

EngineCallbacks()
EngineCallbacks(Firebird::MemoryPool&)
: Callbacks(ERR_post)
{
}
Expand All @@ -60,7 +61,7 @@ namespace Jrd
virtual void isVersion4(bool& v4);

public:
static EngineCallbacks instance;
static Firebird::GlobalPtr<EngineCallbacks> instance;
};
}

Expand Down
28 changes: 23 additions & 5 deletions src/jrd/pwd.cpp
Expand Up @@ -284,15 +284,33 @@ void SecurityDatabase::closeDatabase()
void SecurityDatabase::onShutdown()
{
#ifndef EMBEDDED
MutexLockGuard guard(mutex);
isc_db_handle tmp = 0;
try {
MutexLockGuard guard(mutex);

if (server_shutdown)
if (server_shutdown)
{
return;
}

server_shutdown = true;
tmp = lookup_db;
lookup_db = 0;
closeDatabase();
}
catch (const Firebird::Exception&)
{
return;
if (tmp)
{
isc_detach_database(status, &tmp);
}
}

server_shutdown = true;
closeDatabase();
if (tmp)
{
isc_detach_database(status, &tmp);
checkStatus("isc_detach_database");
}
#endif //EMBEDDED
}

Expand Down

0 comments on commit a1ccc9d

Please sign in to comment.