File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ export class Linkifier2 extends Disposable implements ILinkifier2 {
3939 this . register ( getDisposeArrayDisposable ( this . _linkCacheDisposables ) ) ;
4040 this . register ( toDisposable ( ( ) => {
4141 this . _lastMouseEvent = undefined ;
42+ // Clear out link providers as they could easily cause an embedder memory leak
43+ this . _linkProviders . length = 0 ;
44+ this . _activeProviderReplies ?. clear ( ) ;
4245 } ) ) ;
4346 // Listen to resize to catch the case where it's resized and the cursor is out of the viewport.
4447 this . register ( this . _bufferService . onResize ( ( ) => {
Original file line number Diff line number Diff line change 44 */
55
66import { EventEmitter } from 'common/EventEmitter' ;
7- import { Disposable } from 'common/Lifecycle' ;
7+ import { Disposable , toDisposable } from 'common/Lifecycle' ;
88import { isMac } from 'common/Platform' ;
99import { CursorStyle , IDisposable } from 'common/Types' ;
1010import { FontWeight , IOptionsService , ITerminalOptions } from 'common/services/Services' ;
@@ -86,6 +86,13 @@ export class OptionsService extends Disposable implements IOptionsService {
8686 this . rawOptions = defaultOptions ;
8787 this . options = { ... defaultOptions } ;
8888 this . _setupOptions ( ) ;
89+
90+ // Clear out options that could link outside xterm.js as they could easily cause an embedder
91+ // memory leak
92+ this . register ( toDisposable ( ( ) => {
93+ this . rawOptions . linkHandler = null ;
94+ this . rawOptions . documentOverride = null ;
95+ } ) ) ;
8996 }
9097
9198 // eslint-disable-next-line @typescript-eslint/naming-convention
You can’t perform that action at this time.
0 commit comments