Browse Source

Fix some memory leaks

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 3 years ago
parent
commit
2a8c80557f
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 17 additions and 9 deletions
  1. +1
    -1
      carla
  2. +1
    -1
      dpf
  3. +14
    -5
      src/CardinalUI.cpp
  4. +1
    -2
      src/override/Window.cpp

+ 1
- 1
carla

@@ -1 +1 @@
Subproject commit 782f7f64a7e1a2e197c3e75c90f1d71c8e5b925c
Subproject commit b1ecb33a5ec8d24a98a93ed038713a6da6cc9701

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 0de149b8cbdc59d74273b7fc8b2193b0885afc33
Subproject commit 4ebd02b0ee1a019d46bcd065e21dc68f8af80031

+ 14
- 5
src/CardinalUI.cpp View File

@@ -15,6 +15,7 @@
* For a full copy of the GNU General Public License see the LICENSE file.
*/

#include <app/MenuBar.hpp>
#include <app/Scene.hpp>
#include <asset.hpp>
#include <context.hpp>
@@ -291,8 +292,11 @@ public:

rack::window::WindowSetPluginUI(context->window, this);

if (context->scene->menuBar != nullptr)
context->scene->removeChild(context->scene->menuBar);
if (rack::widget::Widget* const menuBar = context->scene->menuBar)
{
context->scene->removeChild(menuBar);
delete menuBar;
}

context->scene->menuBar = rack::app::createMenuBar(getApp().isStandalone());
context->scene->addChildBelow(context->scene->menuBar, context->scene->rackScroll);
@@ -336,9 +340,14 @@ public:

context->nativeWindowId = 0;

rack::widget::Widget* const menuBar = context->scene->menuBar;
context->scene->menuBar = nullptr;
context->scene->removeChild(menuBar);
if (rack::widget::Widget* const menuBar = context->scene->menuBar)
{
context->scene->removeChild(menuBar);
delete menuBar;
}

context->scene->menuBar = rack::app::createMenuBar();
context->scene->addChildBelow(context->scene->menuBar, context->scene->rackScroll);

rack::window::WindowSetPluginUI(context->window, nullptr);



+ 1
- 2
src/override/Window.cpp View File

@@ -92,9 +92,8 @@ void Font::loadFile(const std::string& filename, NVGcontext* vg) {
// Transfer ownership of font data to font object
uint8_t* data = system::readFile(filename, &size);
// Don't use nvgCreateFont because it doesn't properly handle UTF-8 filenames on Windows.
handle = nvgCreateFontMem(vg, name.c_str(), data, size, 0);
handle = nvgCreateFontMem(vg, name.c_str(), data, size, 1);
if (handle < 0) {
std::free(data);
throw Exception("Failed to load font %s", filename.c_str());
}
INFO("Loaded font %s", filename.c_str());


Loading…
Cancel
Save