aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/rasterizer/archrast
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-10-28 17:21:01 -0500
committerTim Rowley <[email protected]>2016-11-14 09:02:11 -0600
commit2c697754a9d96855c30d1809e67cc676c59de7d1 (patch)
tree909a2f22fe22c61005618a8270b9564b803e8649 /src/gallium/drivers/swr/rasterizer/archrast
parentdc8408920c8c5698d90d2fc7679a5b491ca71248 (diff)
swr: [rasterizer archrast] fix double free issue
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/archrast')
-rw-r--r--src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp10
-rw-r--r--src/gallium/drivers/swr/rasterizer/archrast/archrast.h2
-rw-r--r--src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h20
3 files changed, 22 insertions, 10 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp
index c29bb884588..574098d80a8 100644
--- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp
+++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp
@@ -43,8 +43,8 @@ namespace ArchRast
EventHandlerStatsFile(uint32_t id) : EventHandlerFile(id) {}
// These are events that we're not interested in saving in stats event files.
- virtual void handle(Start& event) {}
- virtual void handle(End& event) {}
+ virtual void Handle(Start& event) {}
+ virtual void Handle(End& event) {}
};
static EventManager* FromHandle(HANDLE hThreadContext)
@@ -64,7 +64,7 @@ namespace ArchRast
if (pManager && pHandler)
{
- pManager->attach(pHandler);
+ pManager->Attach(pHandler);
return pManager;
}
@@ -82,11 +82,11 @@ namespace ArchRast
}
// Dispatch event for this thread.
- void dispatch(HANDLE hThreadContext, Event& event)
+ void Dispatch(HANDLE hThreadContext, Event& event)
{
EventManager* pManager = FromHandle(hThreadContext);
SWR_ASSERT(pManager != nullptr);
- pManager->dispatch(event);
+ pManager->Dispatch(event);
}
}
diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.h b/src/gallium/drivers/swr/rasterizer/archrast/archrast.h
index bdb3afbed99..e6376f208fe 100644
--- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.h
+++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.h
@@ -36,6 +36,6 @@ namespace ArchRast
void DestroyThreadContext(HANDLE hThreadContext);
// Dispatch event for this thread.
- void dispatch(HANDLE hThreadContext, Event& event);
+ void Dispatch(HANDLE hThreadContext, Event& event);
};
diff --git a/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h b/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h
index d162ca8fe57..78ba8f3e2d7 100644
--- a/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h
+++ b/src/gallium/drivers/swr/rasterizer/archrast/eventmanager.h
@@ -43,24 +43,36 @@ namespace ArchRast
class EventManager
{
public:
- void attach(EventHandler* pHandler)
+ EventManager() {}
+
+ ~EventManager()
+ {
+ // Event manager owns destroying handler objects once attached.
+ ///@note See comment for Detach.
+ for (auto pHandler : mHandlers)
+ {
+ delete pHandler;
+ }
+ }
+
+ void Attach(EventHandler* pHandler)
{
mHandlers.push_back(pHandler);
}
- void dispatch(Event& event)
+ void Dispatch(Event& event)
{
///@todo Add event filter check here.
for (auto pHandler : mHandlers)
{
- event.accept(pHandler);
+ event.Accept(pHandler);
}
}
private:
// Handlers stay registered for life
- void detach(EventHandler* pHandler) { SWR_ASSERT(0); }
+ void Detach(EventHandler* pHandler) { SWR_ASSERT(0); }
std::vector<EventHandler*> mHandlers;
};