File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
apps/desktop/src/routes/screenshot-editor Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ function createScreenshotEditorContext() {
134134 } ) ;
135135
136136 const [ latestFrame , setLatestFrame ] = createLazySignal < FrameData > ( ) ;
137+ const [ wsRef , setWsRef ] = createSignal < WebSocket | null > ( null ) ;
137138
138139 const [ editorInstance ] = createResource ( async ( ) => {
139140 const instance = await commands . createScreenshotEditorInstance ( ) ;
@@ -176,6 +177,7 @@ function createScreenshotEditorContext() {
176177
177178 const ws = new WebSocket ( instance . framesSocketUrl ) ;
178179 ws . binaryType = "arraybuffer" ;
180+ setWsRef ( ws ) ;
179181 ws . onmessage = async ( event ) => {
180182 const buffer = event . data as ArrayBuffer ;
181183 if ( buffer . byteLength < 24 ) return ;
@@ -239,6 +241,10 @@ function createScreenshotEditorContext() {
239241 if ( frame ?. bitmap ) {
240242 frame . bitmap . close ( ) ;
241243 }
244+ const ws = wsRef ( ) ;
245+ if ( ws ) {
246+ ws . close ( ) ;
247+ }
242248 } ) ;
243249
244250 const saveConfig = debounce ( ( config : ProjectConfiguration ) => {
You can’t perform that action at this time.
0 commit comments