Cleanup Context API (#1593)

* Cleanup Context API

* Remove exit to prvent crash
This commit is contained in:
Miodrag Milanović 2025-10-23 14:44:14 +02:00 committed by GitHub
parent c133d00e2e
commit a530283600
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 13 deletions

View File

@ -39,15 +39,7 @@ struct Context : Arch, DeterministicRNG
// True when detailed per-net timing is to be stored / reported
bool detailed_timing_report = false;
ArchArgs arch_args;
Context(ArchArgs args) : Arch(args)
{
BaseCtx::as_ctx = this;
arch_args = args;
}
ArchArgs getArchArgs() { return arch_args; }
Context(ArchArgs args) : Arch(args) { BaseCtx::as_ctx = this; }
// --------------------------------------------------------------

View File

@ -3,8 +3,8 @@
#define NOMINMAX
#include <windows.h>
#endif
#include <filesystem>
#include <boost/iostreams/device/mapped_file.hpp>
#include <filesystem>
#include "embed.h"
#include "nextpnr.h"

View File

@ -368,7 +368,7 @@ void BaseMainWindow::open_json()
if (!fileName.isEmpty()) {
disableActions();
if (ctx->settings.find(ctx->id("synth")) == ctx->settings.end()) {
ArchArgs chipArgs = ctx->getArchArgs();
ArchArgs chipArgs = ctx->args;
ctx = std::unique_ptr<Context>(new Context(chipArgs));
Q_EMIT contextChanged(ctx.get());
}

View File

@ -20,7 +20,6 @@
#include "mainwindow.h"
#include <QMessageBox>
#include <cstdlib>
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
@ -46,7 +45,6 @@ void MainWindow::new_proj()
{
QMessageBox::critical(0, "Error",
"Creating a new project not supported in himbächel mode, please re-start from command line.");
std::exit(1);
}
NEXTPNR_NAMESPACE_END