source/lib/VBConnPanel.js
// De-allocate resources to avoid memory leaks

De-allocate resources to avoid memory leaks
De - allocate resources to avoid memory leaks
terminate() {
    this.doTerminateSocket()
    if (this.animationTimer !== null) {
      try {
        this.cancelAnimationFrame(this.animationTimer)
      }
      catch (ex) {
        console.log('Exception in cancelAnimationFrame', ex)
      }
      this.animationTimer = null
    }
    this.packetList = null
    this.vbLog.close()
    this.vbLog = null
    ipcRenderer.removeListener('autoScrollChanged', this.onAutoScrollChanged)
    ipcRenderer.removeListener('autoWrapChanged', this.onAutoWrapChanged)
    ipcRenderer.removeListener('fontFamilyChanged', this.onFontFamilyChanged)
    ipcRenderer.removeListener('fontSizeChanged', this.onFontSizeChanged)
    ipcRenderer.removeListener('bgColorChanged', this.onBgColorChanged)
    ipcRenderer.removeListener('fgColorChanged', this.onFgColorChanged)
    ipcRenderer.removeListener('shortcutsChanged', this.onShortcutsChanged)
    this.webContents.removeListener('found-in-page',  this.onFindInPageResult)
    while (this.connPage.firstChild) {
      this.connPage.removeChild(this.connPage.firstChild)
    }
    if (this.connPage.parentNode) {
      this.connPage.parentNode.removeChild(this.connPage)
    }
    this.connPage = null
  }
terminate ( ) { this . doTerminateSocket ( ) if ( this . animationTimer !== null ) { try { this . cancelAnimationFrame ( this . animationTimer ) } catch ( ex ) { console . log ( 'Exception in cancelAnimationFrame' , ex ) } this . animationTimer = null } this . packetList = null this . vbLog . close ( ) this . vbLog = null ipcRenderer . removeListener ( 'autoScrollChanged' , this . onAutoScrollChanged ) ipcRenderer . removeListener ( 'autoWrapChanged' , this . onAutoWrapChanged ) ipcRenderer . removeListener ( 'fontFamilyChanged' , this . onFontFamilyChanged ) ipcRenderer . removeListener ( 'fontSizeChanged' , this . onFontSizeChanged ) ipcRenderer . removeListener ( 'bgColorChanged' , this . onBgColorChanged ) ipcRenderer . removeListener ( 'fgColorChanged' , this . onFgColorChanged ) ipcRenderer . removeListener ( 'shortcutsChanged' , this . onShortcutsChanged ) this . webContents . removeListener ( 'found-in-page' , this . onFindInPageResult ) while ( this . connPage . firstChild ) { this . connPage . removeChild ( this . connPage . firstChild ) } if ( this . connPage . parentNode ) { this . connPage . parentNode . removeChild ( this . connPage ) } this . connPage = null }
De-allocate resources to avoid memory leaks
De - allocate resources to avoid memory leaks
// Destroy the socket
 // Cancel the animation timer to stop checking the packet list
 // Clear the packet queue
 // Terminate logging
 // Remove IPC event listeners
 // Deallocate DOM resources
