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() {
|
||||
QDir().mkpath(m_path);
|
||||
|
||||
size_t buffLen = 1024;
|
||||
m_romBuff = new QByteArray(buffLen, 0);
|
||||
FileSystem32::format(m_romBuff->data(), buffLen, true);
|
||||
m_romBuff = new QByteArray(1024, 0);
|
||||
FileSystem32::format(m_romBuff->data(), m_romBuff->size(), true);
|
||||
auto fs = ox::fs::createFileSystem(m_romBuff->data(), m_romBuff->size());
|
||||
|
||||
fs->mkdir("/Tilesets");
|
||||
|
||||
QFile file(m_path + "/ROM.oxfs");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(*m_romBuff);
|
||||
file.close();
|
||||
|
||||
delete fs;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,11 +104,12 @@ void MainWindow::showNewWizard() {
|
||||
auto projectPath = wizard.field(PROJECT_PATH).toString();
|
||||
if (QDir(projectPath).exists()) {
|
||||
auto path = projectPath + "/" + projectName;
|
||||
Project(path).create();
|
||||
if (!QDir(path).exists()) {
|
||||
Project(path).create();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
wizard.resize(width() / 3, height() / 3);
|
||||
wizard.show();
|
||||
wizard.exec();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user