aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/command.cc6
-rw-r--r--common/command.h1
-rw-r--r--gui/ecp5/mainwindow.cc1
-rw-r--r--gui/ice40/mainwindow.cc1
4 files changed, 8 insertions, 1 deletions
diff --git a/common/command.cc b/common/command.cc
index f0d028ce..cad89c02 100644
--- a/common/command.cc
+++ b/common/command.cc
@@ -430,7 +430,6 @@ int CommandHandler::exec()
std::unique_ptr<Context> CommandHandler::load_json(std::string filename)
{
- vm.clear();
std::unordered_map<std::string, Property> values;
std::unique_ptr<Context> ctx = createContext(values);
setupContext(ctx.get());
@@ -444,6 +443,11 @@ std::unique_ptr<Context> CommandHandler::load_json(std::string filename)
return ctx;
}
+void CommandHandler::clear()
+{
+ vm.clear();
+}
+
void CommandHandler::run_script_hook(const std::string &name)
{
#ifndef NO_PYTHON
diff --git a/common/command.h b/common/command.h
index e52b5a48..36b6d8ab 100644
--- a/common/command.h
+++ b/common/command.h
@@ -38,6 +38,7 @@ class CommandHandler
int exec();
std::unique_ptr<Context> load_json(std::string filename);
+ void clear();
protected:
virtual void setupArchContext(Context *ctx) = 0;
diff --git a/gui/ecp5/mainwindow.cc b/gui/ecp5/mainwindow.cc
index 5ae1e50f..782cfb65 100644
--- a/gui/ecp5/mainwindow.cc
+++ b/gui/ecp5/mainwindow.cc
@@ -110,6 +110,7 @@ void MainWindow::new_proj()
QString package = QInputDialog::getItem(this, "Select package", "Package:", packages, 0, false, &ok);
if (ok && !item.isEmpty()) {
+ handler->clear();
currentProj = "";
disableActions();
chipArgs.package = package.toStdString().c_str();
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc
index 3c9cab1f..f251fd28 100644
--- a/gui/ice40/mainwindow.cc
+++ b/gui/ice40/mainwindow.cc
@@ -114,6 +114,7 @@ void MainWindow::new_proj()
QString package = QInputDialog::getItem(this, "Select package", "Package:", packages, 0, false, &ok);
if (ok && !item.isEmpty()) {
+ handler->clear();
currentProj = "";
disableActions();
chipArgs.package = package.toStdString().c_str();