Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0bcdd00323d7
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9c2e7d250af6
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Apr 25, 2021

  1. Oscilloscope: don't try dereferencing trigger inputs in destructor as…

    … this can lead to a pure virtual function call. Fixes #405.
    azonenberg committed Apr 25, 2021
    Copy the full SHA
    9c2e7d2 View commit details
Showing with 17 additions and 2 deletions.
  1. +13 −1 scopehal/FlowGraphNode.cpp
  2. +2 −0 scopehal/FlowGraphNode.h
  3. +2 −1 scopehal/Oscilloscope.cpp
14 changes: 13 additions & 1 deletion scopehal/FlowGraphNode.cpp
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* Copyright (c) 2012-2021 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -59,6 +59,18 @@ FlowGraphNode::~FlowGraphNode()
}
}

/**
@brief Disconnects all inputs from the node without releasing them.
This function is intended for use in Oscilloscope::~Oscilloscope() only.
Using it carelessly is likely to lead to memory leaks.
*/
void FlowGraphNode::DetachInputs()
{
for(auto& c : m_inputs)
c.m_channel = NULL;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Accessors

2 changes: 2 additions & 0 deletions scopehal/FlowGraphNode.h
Original file line number Diff line number Diff line change
@@ -92,6 +92,8 @@ class FlowGraphNode
FlowGraphNode();
virtual ~FlowGraphNode();

void DetachInputs();

//Inputs
public:
size_t GetInputCount();
3 changes: 2 additions & 1 deletion scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* Copyright (c) 2012-2021 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -60,6 +60,7 @@ Oscilloscope::~Oscilloscope()
{
if(m_trigger)
{
m_trigger->DetachInputs();
delete m_trigger;
m_trigger = NULL;
}