Fix memory leak in studio project create
This commit is contained in:
parent
df76f9eb2c
commit
be9655c0b1
@ -23,14 +23,18 @@ Project::Project(QString path) {
|
|||||||
void Project::create() {
|
void Project::create() {
|
||||||
QDir().mkpath(m_path);
|
QDir().mkpath(m_path);
|
||||||
|
|
||||||
size_t buffLen = 1024;
|
m_romBuff = new QByteArray(1024, 0);
|
||||||
m_romBuff = new QByteArray(buffLen, 0);
|
FileSystem32::format(m_romBuff->data(), m_romBuff->size(), true);
|
||||||
FileSystem32::format(m_romBuff->data(), buffLen, true);
|
auto fs = ox::fs::createFileSystem(m_romBuff->data(), m_romBuff->size());
|
||||||
|
|
||||||
|
fs->mkdir("/Tilesets");
|
||||||
|
|
||||||
QFile file(m_path + "/ROM.oxfs");
|
QFile file(m_path + "/ROM.oxfs");
|
||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
file.write(*m_romBuff);
|
file.write(*m_romBuff);
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
delete fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,12 @@ void MainWindow::showNewWizard() {
|
|||||||
auto projectPath = wizard.field(PROJECT_PATH).toString();
|
auto projectPath = wizard.field(PROJECT_PATH).toString();
|
||||||
if (QDir(projectPath).exists()) {
|
if (QDir(projectPath).exists()) {
|
||||||
auto path = projectPath + "/" + projectName;
|
auto path = projectPath + "/" + projectName;
|
||||||
|
if (!QDir(path).exists()) {
|
||||||
Project(path).create();
|
Project(path).create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
wizard.resize(width() / 3, height() / 3);
|
|
||||||
wizard.show();
|
wizard.show();
|
||||||
wizard.exec();
|
wizard.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user