Skip to content

Commit 20f1d27

Browse files
committed
Allow display manager to cleanup expired instances
1 parent 7763da4 commit 20f1d27

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Client/mods/deathmatch/logic/CClientVectorGraphic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CClientVectorGraphic::CClientVectorGraphic(CClientManager* pManager, ElementID I
1818

1919
m_pManager = pManager;
2020

21-
m_pVectorGraphicDisplay = std::make_unique<CClientVectorGraphicDisplay>(m_pManager->GetDisplayManager(), this);
21+
m_pVectorGraphicDisplay = new CClientVectorGraphicDisplay(m_pManager->GetDisplayManager(), this);
2222

2323
// Generate the default XML document
2424
SString defaultXmlString = SString("<svg viewBox='0 0 %u %u'></svg>", pVectorGraphicItem->m_uiSizeX, pVectorGraphicItem->m_uiSizeY);

Client/mods/deathmatch/logic/CClientVectorGraphic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CClientVectorGraphic final : public CClientTexture
3636
lunasvg::Document* GetSVGDocument() const { return m_pSVGDocument.get(); }
3737
CXMLNode* GetXMLDocument() const { return m_pXMLDocument; }
3838

39-
CClientVectorGraphicDisplay* GetDisplay() const { return m_pVectorGraphicDisplay.get(); }
39+
CClientVectorGraphicDisplay* GetDisplay() const { return m_pVectorGraphicDisplay; }
4040

4141
bool IsDisplayCleared() const { return m_pVectorGraphicDisplay->IsCleared(); }
4242
bool IsDestroyed() const { return m_bIsDestroyed; }
@@ -57,7 +57,7 @@ class CClientVectorGraphic final : public CClientTexture
5757
std::unique_ptr<SXMLString> m_pXMLString = nullptr;
5858
CXMLNode* m_pXMLDocument = nullptr;
5959

60-
std::unique_ptr<CClientVectorGraphicDisplay> m_pVectorGraphicDisplay;
60+
CClientVectorGraphicDisplay* m_pVectorGraphicDisplay;
6161

6262
std::variant<CLuaFunctionRef, bool> m_updateCallbackRef = false;
6363

Client/mods/deathmatch/logic/CClientVectorGraphicDisplay.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ void CClientVectorGraphicDisplay::Render()
4242
{
4343
m_pVectorGraphic->OnUpdate();
4444
}
45+
46+
// if we don't update the SVG, or vector graphic is deleted, after 60 seconds the display manager will destroy it
47+
// see CClientDisplayManager::DoPulse
48+
SetTimeTillExpiration(60 * 1000);
4549
}
4650

4751
void CClientVectorGraphicDisplay::UnpremultiplyBitmap(Bitmap& bitmap)

0 commit comments

Comments
 (0)