Fix for multiplot in snapshot
martijuerg opened this issue · comments
Multiplot in a snapshot is crashing because of access to PlotManager::_stream which is nullptr when PlotManger is used on a Snapshot. When adding a check for nullptr and we get nice multiplots in snapshots.
Patch:
diff -r a097738f33a7 src/plotmanager.cpp
--- a/src/plotmanager.cpp Sun Dec 27 21:17:54 2020 +0300
+++ b/src/plotmanager.cpp Sun Jan 03 10:53:45 2021 +0100
@@ -242,7 +242,10 @@
{
auto plot = addPlotWidget();
plot->setVisible(curve->isVisible());
- plot->setDispChannels(QVector<const StreamChannel*>(1, _stream->channel(i)));
+ if (_stream != nullptr)
+ {
+ plot->setDispChannels(QVector<const StreamChannel*>(1, _stream->channel(i)));
+ }
curve->attach(plot);
i++;
}
@martijuerg I've moved your fix to mainline. Thanks a lot. https://hg.sr.ht/~hyozd/serialplot/rev/de88c6d963afb91ba082bc9d3cf9ed8145e2b62f