ISOTP and Scripting bug fixes

This commit is contained in:
Collin Kidder
2018-02-04 18:11:25 -05:00
parent 028a108169
commit 96b73bd1ca
5 changed files with 70 additions and 23 deletions
+7 -2
View File
@@ -204,7 +204,7 @@ void ScriptingWindow::loadNewScript()
QString justFileName = fileList[fileList.length() - 1];
ui->listLoadedScripts->addItem(justFileName);
container = new ScriptContainer;
container = new ScriptContainer();
container->fileName = justFileName;
container->filePath = filename;
container->scriptText = contents;
@@ -223,7 +223,7 @@ void ScriptingWindow::createNewScript()
{
ScriptContainer *container;
container = new ScriptContainer;
container = new ScriptContainer();
container->fileName = "UNNAMED_" + QString::number((qrand() % 10000)) + ".js";
container->filePath = QString();
@@ -238,6 +238,8 @@ void ScriptingWindow::createNewScript()
void ScriptingWindow::deleteCurrentScript()
{
ScriptContainer* thisScript;
int sel = ui->listLoadedScripts->currentRow();
if (sel < 0) return;
@@ -250,7 +252,10 @@ void ScriptingWindow::deleteCurrentScript()
{
case QMessageBox::Yes:
ui->listLoadedScripts->takeItem(sel);
thisScript = scripts.at(sel);
scripts.removeAt(sel);
delete thisScript; //causes a seg fault. Seems to be due to currently running javascript code. No idea how to stop code from running
thisScript = NULL;
currentScript = NULL;
if (ui->listLoadedScripts->count() > 0)