diff --git a/Sources/IO/Core/ImageStream/index.js b/Sources/IO/Core/ImageStream/index.js index 91e0d879d6a..eb74823c52f 100644 --- a/Sources/IO/Core/ImageStream/index.js +++ b/Sources/IO/Core/ImageStream/index.js @@ -64,12 +64,11 @@ function vtkImageStream(publicAPI, model) { // -------------------------------------------------------------------------- publicAPI.disconnect = () => { - if (model.protocol && model.connected) { - model.protocol.unsubscribeToImageStream( - model.imageStreamTopicSubscription - ); - model.imageStreamTopicSubscription = null; + if (model.protocol && model.connected && model.renderTopicSubscription) { + model.protocol.unsubscribeToImageStream(model.renderTopicSubscription); + model.renderTopicSubscription = null; } + model.connected = false; }; // --------------------------------------------------------------------------