[nostalgia/studio] Add cleanup for module loading
This commit is contained in:
parent
08da9d6a94
commit
5672074177
@ -79,7 +79,9 @@ MainWindow::~MainWindow() {
|
|||||||
|
|
||||||
void MainWindow::loadModules() {
|
void MainWindow::loadModules() {
|
||||||
for (auto p : BuiltinModules) {
|
for (auto p : BuiltinModules) {
|
||||||
loadModule(p());
|
auto module = p();
|
||||||
|
loadModule(module);
|
||||||
|
delete module;
|
||||||
}
|
}
|
||||||
for (auto dir : m_profile.modulesPath) {
|
for (auto dir : m_profile.modulesPath) {
|
||||||
QFileInfo dirInfo(m_profilePath);
|
QFileInfo dirInfo(m_profilePath);
|
||||||
@ -106,6 +108,7 @@ void MainWindow::loadModule(QString modulePath) {
|
|||||||
auto module = qobject_cast<Module*>(loader.instance());
|
auto module = qobject_cast<Module*>(loader.instance());
|
||||||
if (module) {
|
if (module) {
|
||||||
loadModule(module);
|
loadModule(module);
|
||||||
|
delete module;
|
||||||
} else {
|
} else {
|
||||||
qInfo() << loader.errorString();
|
qInfo() << loader.errorString();
|
||||||
}
|
}
|
||||||
@ -360,7 +363,7 @@ void MainWindow::openProject(QString projectPath) {
|
|||||||
openFile(t, true);
|
openFile(t, true);
|
||||||
} catch (const ox::Error &err) {
|
} catch (const ox::Error &err) {
|
||||||
qInfo().nospace() << "Error opening tab: " << t << ", " << static_cast<int>(err) << ", " << err.file << ":" << err.line;
|
qInfo().nospace() << "Error opening tab: " << t << ", " << static_cast<int>(err) << ", " << err.file << ":" << err.line;
|
||||||
oxTracef("nostalgia::studio::MainWindow::openProject", "Error opening tab: {}, {}, {}:{}", static_cast<int>(err), static_cast<int>(err), err.file, err.line);
|
oxTracef("nostalgia::studio::MainWindow::openProject", "Error opening tab: {}, {}, {}:{}", static_cast<int>(err), static_cast<int>(err), err.file, err.line);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
qInfo() << "Error opening tab: " << t;
|
qInfo() << "Error opening tab: " << t;
|
||||||
oxTracef("nostalgia::studio::MainWindow::openProject", "Error opening tab: {}", t);
|
oxTracef("nostalgia::studio::MainWindow::openProject", "Error opening tab: {}", t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user