From: <ale...@us...> - 2014-05-06 12:25:39
|
Revision: 59543 http://sourceforge.net/p/firebird/code/59543 Author: alexpeshkoff Date: 2014-05-06 12:25:35 +0000 (Tue, 06 May 2014) Log Message: ----------- Fixed a bug, privately reported by Pavel Zotov - segfault when closing trace Modified Paths: -------------- firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/svc.cpp Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2014-05-06 10:29:59 UTC (rev 59542) +++ firebird/trunk/src/jrd/jrd.cpp 2014-05-06 12:25:35 UTC (rev 59543) @@ -3761,7 +3761,6 @@ validateHandle(svc); svc->detach(); - svc = NULL; } catch (const Exception& ex) { Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2014-05-06 10:29:59 UTC (rev 59542) +++ firebird/trunk/src/jrd/svc.cpp 2014-05-06 12:25:35 UTC (rev 59543) @@ -213,9 +213,11 @@ Service::ExistenceGuard::ExistenceGuard(Service* svc, const char* from) : SafeMutexLock(svc, from) { - if (!lock()) + bool lck = lock(); + if (!lck) { // could not lock service + jSvc->mutex.leave(); Arg::Gds(isc_bad_svc_handle).raise(); } } @@ -233,29 +235,26 @@ } Service::UnlockGuard::UnlockGuard(Service* svc, const char* from) - : SafeMutexLock(svc, from), locked(true), doLock(true) + : SafeMutexLock(svc, from), locked(false), doLock(false) { jSvc->mutex.leave(); - locked = false; + doLock = true; } bool Service::UnlockGuard::enter() { - doLock = false; - if (!locked) + if (doLock) { - if (!lock()) - { - return false; - } - locked = true; + locked = lock(); + doLock = false; } - return true; + + return locked; } Service::UnlockGuard::~UnlockGuard() { - if (doLock && (!locked) && (!lock())) + if (!enter()) { // could not lock service DtorException::devHalt(); @@ -954,6 +953,9 @@ delete svc_trace_manager; svc_trace_manager = NULL; + + fb_assert(jSvc->mutex.locked()); + jSvc->svc = NULL; } @@ -1983,14 +1985,18 @@ try { Service* svc = (Service*)arg; + RefPtr<JService> ref(svc->jSvc); int exit_code = svc->svc_service_run->serv_thd(svc); svc->started(); svc->svc_sem_full.release(); svc->finish(SVC_finished); } - catch(const Exception&) - { /* Not much we can do here */ } + catch(const Exception& ex) + { + // Not much we can do here + iscLogException("Exception in Service::run():", ex); + } return (THREAD_ENTRY_RETURN)(IPTR) exit_code; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |