diff --git a/samples/material_sandbox.cpp b/samples/material_sandbox.cpp index 5ac852c10b..9d1f49610e 100644 --- a/samples/material_sandbox.cpp +++ b/samples/material_sandbox.cpp @@ -191,6 +191,8 @@ static int handleCommandLineArgments(int argc, char* argv[], Config* config) { } static void cleanup(Engine* engine, View*, Scene*) { + g_meshSet.reset(nullptr); + for (const auto& material : g_meshMaterialInstances) { engine->destroy(material.second); } @@ -203,8 +205,6 @@ static void cleanup(Engine* engine, View*, Scene*) { engine->destroy(i); } - g_meshSet.reset(nullptr); - engine->destroy(g_params.light); engine->destroy(g_params.spotLight); engine->destroy(g_colorGrading);