Skip to content

Commit

Permalink
bugfix: opening external data in waveform-viewer only once
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed May 22, 2024
1 parent 2d84266 commit 5f601df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ namespace hal

private:
bool mVisualizeNetState;
bool mOwnershipRequired;

QAction* mCreateControlAction;
QAction* mSimulSettingsAction;
Expand Down
7 changes: 6 additions & 1 deletion plugins/simulator/waveform_viewer/src/waveform_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace hal

WaveformViewer::WaveformViewer(QWidget *parent)
: ExternalContentWidget("waveform_viewer","WaveformViewer",parent),
mVisualizeNetState(false), mCurrentWaveWidget(nullptr)
mVisualizeNetState(false), mOwnershipRequired(false), mCurrentWaveWidget(nullptr)
{
LogManager::get_instance()->add_channel(std::string("waveform_viewer"), {LogManager::create_stdout_sink(), LogManager::create_file_sink(), LogManager::create_gui_sink()}, "info");
mCreateControlAction = new QAction(this);
Expand Down Expand Up @@ -366,6 +366,9 @@ namespace hal

void WaveformViewer::handleControllerAdded(u32 controllerId)
{
// nothing to do here, viewer will open widget when taking over ownership
if (mOwnershipRequired) return;

// check whether controller already added
for (int inx=0; inx<mTabWidget->count(); inx++)
{
Expand Down Expand Up @@ -406,8 +409,10 @@ namespace hal
NetlistSimulatorControllerPlugin* ctrlPlug = static_cast<NetlistSimulatorControllerPlugin*>(plugin_manager::get_plugin_instance("netlist_simulator_controller"));
if (ctrlPlug)
{
mOwnershipRequired = true;
std::unique_ptr<NetlistSimulatorController> ctrlRef = ctrlPlug->restore_simulator_controller(gNetlist,filename.toStdString());
takeControllerOwnership(ctrlRef, true);
mOwnershipRequired = false;
}
}
else if (mCurrentWaveWidget && mCurrentWaveWidget->controller()->can_import_data() && filename.toLower().endsWith(".vcd"))
Expand Down

0 comments on commit 5f601df

Please sign in to comment.