Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed crash when no simulators found on first start #992

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qucs/components/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ Component *getComponentFromName(QString &Line, Schematic *p) {

if (!c) {
/// \todo enable user to load partial schematic, skip unknown components
if (QucsMain != 0) {
if (QucsMain != nullptr) {
QMessageBox *msg = new QMessageBox(QMessageBox::Warning, QObject::tr("Warning"),
QObject::tr("Format Error:\nUnknown component!\n"
"%1\n\n"
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/spicefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ bool SpiceFile::recreateSubNetlist(QString *SpiceFile, QString *FileName)
(*filstream) << NetText;

// only interact with the GUI if it was launched
if (QucsMain) {
if (QucsMain != nullptr) {
QucsMain->statusBar()->showMessage(tr("Converting SPICE file \"%1\".").arg(*SpiceFile), 2000);
}
else
Expand Down
2 changes: 1 addition & 1 deletion qucs/extsimkernels/ngspice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ void Ngspice::slotSimulate()
QString ngsp_cmd = cmd_args.at(0);
cmd_args.removeAt(0);
SimProcess->start(ngsp_cmd,cmd_args);
if (QucsMain)
if (QucsMain != nullptr)
emit started();
}

Expand Down
6 changes: 4 additions & 2 deletions qucs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

tQucsSettings QucsSettings;

QucsApp *QucsMain = 0; // the Qucs application itself
QucsApp *QucsMain = nullptr; // the Qucs application itself
QString lastDir; // to remember last directory for several dialogs
QStringList qucsPathList;
VersionTriplet QucsVersion; // Qucs version string
Expand Down Expand Up @@ -179,7 +179,9 @@ bool saveApplSettings()
qs.setItem<QString>("font", QucsSettings.font.toString());
qs.setItem<QString>("appFont", QucsSettings.appFont.toString());
qs.setItem<QString>("textFont", QucsSettings.textFont.toString());
qs.setItem<QByteArray>("MainWindowGeometry", QucsMain->saveGeometry());
if (QucsMain != nullptr) {
qs.setItem<QByteArray>("MainWindowGeometry", QucsMain->saveGeometry());
}

// store LargeFontSize as a string, so it will be also human-readable in the settings file (will be a @Variant() otherwise)
qs.setItem<QString>("LargeFontSize", QString::number(QucsSettings.largeFontSize));
Expand Down
4 changes: 2 additions & 2 deletions qucs/schematic_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ bool Schematic::loadDocument()
QFile file(DocName);
if(!file.open(QIODevice::ReadOnly)) {
/// \todo implement unified error/warning handling GUI and CLI
if (QucsMain)
if (QucsMain != nullptr)
QMessageBox::critical(0, QObject::tr("Error"),
QObject::tr("Cannot load document: ")+DocName);
else
Expand Down Expand Up @@ -1509,7 +1509,7 @@ bool Schematic::throughAllComps(QTextStream *stream, int& countInit,
delete d;
/// \todo implement error/warning message dispatcher for GUI and CLI modes.
QString message = QObject::tr("ERROR: Cannot load subcircuit \"%1\".").arg(s);
if (QucsMain) // GUI is running
if (QucsMain != nullptr) // GUI is running
ErrText->appendPlainText(message);
else // command line
qCritical() << "Schematic::throughAllComps" << message;
Expand Down
Loading