Skip to content

Commit cedc0c4

Browse files
committed
shutdownLib()
1 parent 21f2e3f commit cedc0c4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/ssvg/ssvg.h

+1
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ struct ImageLoadFlags
324324
};
325325

326326
void initLib(bx::AllocatorI* allocator);
327+
void shutdownLib();
327328

328329
Image* imageLoad(const char* xmlStr, uint32_t flags, const ShapeAttributes* baseAttrs);
329330
bool imageSave(const Image* img, bx::WriterI* writer);

src/ssvg.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,20 @@ void initLib(bx::AllocatorI* allocator)
571571
s_ShapeAttrFreeListHead = nullptr;
572572
}
573573

574+
void shutdownLib()
575+
{
576+
ShapeAttributeFreeListNode* node = s_ShapeAttrFreeListHead;
577+
while (node) {
578+
ShapeAttributeFreeListNode* next = node->m_Next;
579+
580+
BX_FREE(s_Allocator, node->m_Attrs);
581+
BX_FREE(s_Allocator, node);
582+
583+
node = next;
584+
}
585+
s_ShapeAttrFreeListHead = nullptr;
586+
}
587+
574588
bool shapeCopy(Shape* dst, const Shape* src, bool copyAttrs)
575589
{
576590
const ShapeType::Enum type = src->m_Type;

0 commit comments

Comments
 (0)