[nostalgia/studio] Fix memory leak of ProjectExplorer not getting freed
This commit is contained in:
parent
c7af7bc54c
commit
fd0d15b28e
@ -9,7 +9,6 @@
|
|||||||
#include "lib/configio.hpp"
|
#include "lib/configio.hpp"
|
||||||
#include "builtinmodules.hpp"
|
#include "builtinmodules.hpp"
|
||||||
#include "filedialogmanager.hpp"
|
#include "filedialogmanager.hpp"
|
||||||
#include "nostalgia/core/input.hpp"
|
|
||||||
#include "studioapp.hpp"
|
#include "studioapp.hpp"
|
||||||
|
|
||||||
namespace nostalgia {
|
namespace nostalgia {
|
||||||
@ -32,7 +31,7 @@ oxModelEnd()
|
|||||||
|
|
||||||
StudioUI::StudioUI(core::Context *ctx) noexcept {
|
StudioUI::StudioUI(core::Context *ctx) noexcept {
|
||||||
m_ctx = ctx;
|
m_ctx = ctx;
|
||||||
m_projectExplorer = new ProjectExplorer(m_ctx);
|
m_projectExplorer = ox::make_unique<ProjectExplorer>(m_ctx);
|
||||||
m_projectExplorer->fileChosen.connect(this, &StudioUI::openFile);
|
m_projectExplorer->fileChosen.connect(this, &StudioUI::openFile);
|
||||||
loadModules();
|
loadModules();
|
||||||
// open project and files
|
// open project and files
|
||||||
@ -283,8 +282,8 @@ ox::Error StudioUI::openProject(const ox::String &path) noexcept {
|
|||||||
m_project = ox::make_unique<studio::Project>(m_ctx->rom.get(), path);
|
m_project = ox::make_unique<studio::Project>(m_ctx->rom.get(), path);
|
||||||
auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
auto sctx = applicationData<studio::StudioContext>(m_ctx);
|
||||||
sctx->project = m_project.get();
|
sctx->project = m_project.get();
|
||||||
m_project->fileAdded.connect(m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
|
m_project->fileAdded.connect(m_projectExplorer.get(), &ProjectExplorer::refreshProjectTreeModel);
|
||||||
m_project->fileDeleted.connect(m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel);
|
m_project->fileDeleted.connect(m_projectExplorer.get(), &ProjectExplorer::refreshProjectTreeModel);
|
||||||
m_openFiles.clear();
|
m_openFiles.clear();
|
||||||
m_editors.clear();
|
m_editors.clear();
|
||||||
studio::editConfig<StudioConfig>(m_ctx, [&](StudioConfig *config) {
|
studio::editConfig<StudioConfig>(m_ctx, [&](StudioConfig *config) {
|
||||||
|
@ -27,7 +27,7 @@ class StudioUI: public ox::SignalHandler {
|
|||||||
ox::Vector<ox::UniquePtr<studio::BaseEditor>> m_editors;
|
ox::Vector<ox::UniquePtr<studio::BaseEditor>> m_editors;
|
||||||
ox::Vector<ox::UniquePtr<studio::Widget>> m_widgets;
|
ox::Vector<ox::UniquePtr<studio::Widget>> m_widgets;
|
||||||
ox::HashMap<ox::String, studio::EditorMaker::Func> m_editorMakers;
|
ox::HashMap<ox::String, studio::EditorMaker::Func> m_editorMakers;
|
||||||
ProjectExplorer *m_projectExplorer = nullptr;
|
ox::UniquePtr<ProjectExplorer> m_projectExplorer;
|
||||||
ox::Vector<ox::String> m_openFiles;
|
ox::Vector<ox::String> m_openFiles;
|
||||||
studio::BaseEditor *m_activeEditor = nullptr;
|
studio::BaseEditor *m_activeEditor = nullptr;
|
||||||
studio::BaseEditor *m_activeEditorUpdatePending = nullptr;
|
studio::BaseEditor *m_activeEditorUpdatePending = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user