Ensure boo IObj instances are heap-allocated

This commit is contained in:
Jack Andersen 2017-11-19 13:44:46 -10:00
parent 403249582a
commit 49d76b84be
2 changed files with 28 additions and 27 deletions

View File

@ -10,8 +10,9 @@ namespace boo
class IObj class IObj
{ {
std::atomic_int m_refCount = {0}; std::atomic_int m_refCount = {0};
public: protected:
virtual ~IObj() = default; virtual ~IObj() = default;
public:
virtual std::unique_lock<std::recursive_mutex> destructorLock() { return {}; } virtual std::unique_lock<std::recursive_mutex> destructorLock() { return {}; }
void increment() { m_refCount++; } void increment() { m_refCount++; }
void decrement() void decrement()

View File

@ -1231,6 +1231,8 @@ struct MetalCommandQueue : IGraphicsCommandQueue
if (!m_running) if (!m_running)
return; return;
@autoreleasepool
{
/* Update dynamic data here */ /* Update dynamic data here */
MetalDataFactoryImpl* gfxF = static_cast<MetalDataFactoryImpl*>(m_parent->getDataFactory()); MetalDataFactoryImpl* gfxF = static_cast<MetalDataFactoryImpl*>(m_parent->getDataFactory());
std::unique_lock<std::recursive_mutex> datalk(gfxF->m_dataMutex); std::unique_lock<std::recursive_mutex> datalk(gfxF->m_dataMutex);
@ -1257,8 +1259,6 @@ struct MetalCommandQueue : IGraphicsCommandQueue
} }
datalk.unlock(); datalk.unlock();
@autoreleasepool
{
[m_enc endEncoding]; [m_enc endEncoding];
m_enc = nullptr; m_enc = nullptr;