fix(Foundation): use after free warnings #4189

This commit is contained in:
Alex Fabijanic 2023-10-23 23:45:05 +02:00
parent 47ddacd004
commit cd12420495
2 changed files with 9 additions and 1 deletions

View File

@ -302,6 +302,10 @@ public:
protected:
P activateObject(P pObject)
{
#if defined(POCO_COMPILER_GCC)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuse-after-free"
#endif
try
{
_factory.activateObject(pObject);
@ -312,6 +316,9 @@ protected:
throw;
}
return pObject;
#if defined(POCO_COMPILER_GCC)
#pragma GCC diagnostic pop
#endif
}
private:

View File

@ -13,6 +13,7 @@
#include "CppUnit/TestSuite.h"
#include "Poco/AutoPtr.h"
#include "Poco/Exception.h"
#include <atomic>
using Poco::AutoPtr;
@ -66,7 +67,7 @@ namespace
}
private:
int _rc;
std::atomic<int> _rc;
static int _count;
};