Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disposed channels are still usable #42582

Closed
octref opened this issue Jan 31, 2018 · 2 comments
Closed

Disposed channels are still usable #42582

octref opened this issue Jan 31, 2018 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug output Output channel system issues verified Verification succeeded
Milestone

Comments

@octref
Copy link
Contributor

octref commented Jan 31, 2018

Testing #40716

I have this setup:

(Notice I changed "Clear Channel" to run channel.dispose)

export const activate = (context: vscode.ExtensionContext) => {
  let timer,
    counter = 1;

  let channel = vscode.window.createOutputChannel('Test Channel');
  vscode.commands.registerCommand('testExtension.clearChannel', () => channel.dispose());
  vscode.commands.registerCommand('testExtension.showChannel', () => channel.show() );
  vscode.commands.registerCommand('testExtension.hideChannel', () => channel.hide());
  vscode.commands.registerCommand('testExtension.startAppending', () => {
    if (!timer) {
      timer = setInterval(
        () => {
          if (counter % 2 === 0) {
            channel.appendLine(
              `${counter++} // Cancellation that controls whether or not we can cancel in the middle of type checking. In general cancelling is *not* safe for the type checker.  We might be in the middle of computing something, and we will leave our internals in an inconsistent state.  Callers who set the cancellation token should catch if a cancellation exception occurs, and should throw away and create a new TypeChecker.`
            )
          } else {
            counter++;
            channel.append(`Test\n`)
          }
        },

        1000
      );
    }
  });
};

When I dispose the channel, it's gone from the UI. However, if one still has a reference to it, after using appendLine the channel comes back.

My suggestion is to error out for such cases.

test

@octref octref added the output Output channel system issues label Jan 31, 2018
@sandy081 sandy081 added this to the January 2018 milestone Jan 31, 2018
@sandy081
Copy link
Member

Assigning to January for investigation

@sandy081 sandy081 added the bug Issue identified by VS Code Team member as probable bug label Jan 31, 2018
@sandy081 sandy081 modified the milestones: January 2018, February 2018 Jan 31, 2018
@sandy081
Copy link
Member

sandy081 commented Jan 31, 2018

Good catch @octref

Checked that this is not a regression and hence moved to February

@mjbvz mjbvz added the verified Verification succeeded label Mar 1, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug output Output channel system issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants