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
2
dpf
2
dpf
|
@ -1 +1 @@
|
|||
Subproject commit 11e76be7057c8b189a593ca328aa871fe61fc699
|
||||
Subproject commit 1cc5641ba765dcb22da32c66faf3a09f808bfb27
|
|
@ -76,6 +76,7 @@ static const constexpr uint kCardinalStateCount = kCardinalStateBaseCount;
|
|||
namespace rack {
|
||||
namespace asset {
|
||||
std::string patchesPath();
|
||||
void destroy();
|
||||
}
|
||||
namespace engine {
|
||||
void Engine_setAboutToClose(Engine*);
|
||||
|
@ -290,6 +291,9 @@ struct Initializer
|
|||
INFO("Destroying plugins");
|
||||
plugin::destroyStaticPlugins();
|
||||
|
||||
INFO("Destroying colourized assets");
|
||||
asset::destroy();
|
||||
|
||||
INFO("Destroying settings");
|
||||
settings::destroy();
|
||||
|
||||
|
|
|
@ -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