Fix light mode nsvg cleanup
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
0f3ab5ddf0
commit
36ae333490
3 changed files with 29 additions and 2 deletions
|
|
@ -775,7 +775,7 @@ void nsvgDeleteCardinal(NSVGimage*);
|
|||
}
|
||||
|
||||
struct ExtendedNSVGimage {
|
||||
NSVGimage* handle;
|
||||
NSVGimage* const handle;
|
||||
NSVGimage* handleOrig;
|
||||
NSVGimage* handleMOD;
|
||||
NSVGshape* shapesOrig;
|
||||
|
|
@ -1088,3 +1088,26 @@ void switchDarkMode(const bool darkMode)
|
|||
std::memcpy(ext.handle, !darkMode ? ext.handleMOD : ext.handleOrig, sizeof(NSVGimage));
|
||||
}
|
||||
}
|
||||
|
||||
namespace rack {
|
||||
namespace asset {
|
||||
|
||||
void destroy() {
|
||||
for (auto it = loadedDarkSVGs.begin(), end = loadedDarkSVGs.end(); it != end; ++it)
|
||||
{
|
||||
ExtendedNSVGimage& ext(*it);
|
||||
deleteExtendedNSVGimage(ext);
|
||||
}
|
||||
|
||||
for (auto it = loadedLightSVGs.begin(), end = loadedLightSVGs.end(); it != end; ++it)
|
||||
{
|
||||
ExtendedNSVGimage& ext(*it);
|
||||
deleteExtendedNSVGimage(ext);
|
||||
}
|
||||
|
||||
loadedDarkSVGs.clear();
|
||||
loadedLightSVGs.clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue