8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 15:23:03 +01:00

Fix a crash appeared after the bugfix for #8185 (SIGSEGV with WHERE CURRENT OF statement with statement cache turned on). Reproducible with QA test bugs.core_5231 (release build only). This fix is a very simple one, just to avoid the object state being read after its possible removal. The returned usage counter is not used anyway.

This commit is contained in:
Dmitry Yemanov 2025-01-15 16:53:09 +03:00
parent fe178a1404
commit 69690fd44e
2 changed files with 5 additions and 9 deletions

View File

@ -56,17 +56,15 @@ void DsqlStatement::rethrowDdlException(status_exception& ex, bool metadataUpdat
status_exception::raise(newVector);
}
int DsqlStatement::release()
void DsqlStatement::release()
{
fb_assert(refCounter.value() > 0);
int refCnt = --refCounter;
if (!refCnt)
if (!--refCounter)
{
if (cacheKey)
{
dsqlAttachment->dbb_statement_cache->statementGoingInactive(cacheKey);
refCnt = refCounter;
}
else
{
@ -74,8 +72,6 @@ int DsqlStatement::release()
dsqlAttachment->deletePool(&getPool());
}
}
return refCnt;
}
void DsqlStatement::doRelease()

View File

@ -83,12 +83,12 @@ protected:
virtual ~DsqlStatement() = default;
public:
int addRef()
void addRef()
{
return ++refCounter;
++refCounter;
}
int release();
void release();
bool isCursorBased() const
{