ngscopeclient / scopehal-apps

ngscopeclient and other client applications for libscopehal.
https://www.ngscopeclient.org/
BSD 3-Clause "New" or "Revised" License
584 stars 93 forks source link

Unclear how to delete a filter graph node #634

Open juh2600 opened 10 months ago

juh2600 commented 10 months ago

Expected behavior: To delete a node, either click the node and hit Delete or Backspace on the keyboard, or right/double-click the node and choose a "Delete" option.

Observed behavior:

azonenberg commented 10 months ago

As of now, filter objects and channels are reference counted and automatically deleted when the last consumer (measurement display, sink / export filter, waveform view, or filter/channel input) is removed. So we don't allow deletion of a node explicitly, you simply stop using it and it goes away.

I agree this is potentially not the best UX, but it's not a trivial problem: if you delete the last viewport showing a waveform and don't have the graph view open or any other filters consuming its output, it seems intuitive that the filter generating that waveform should disappear and stop consuming resources.

But if you have the graph view open you might want to keep it around so you can use it somewhere else. We also have some ugly hacks in the code around export filters (which have nothing consuming their output, as there are no output channels); right now they are impossible to delete once added and they might leak memory although I think we do ultimately delete them when the session is closed.

Open to discussion on how to improve the UX around this.

azonenberg commented 10 months ago

For starters, what would you expect to happen if you try to delete a node which is still in use?

Should it be deleted immediately without prompting, removing it from all waveform display and disconnecting any inputs that it was connected to?

Should it pop up a confirmation message if other filters are using its output?

Should the deletion silently be refused?

azonenberg commented 10 months ago

The same reference counting also applies to instrument inputs: a channel which has at least one consumer is considered active (data will be downloaded from the scope and the channel is enabled in hardware). Once it reaches zero references it will be disabled (which may allow higher sample rates or more memory depth on some scopes) and its node will disappear from the filter graph.