Fix TypeError: BrowserView.destroy is not a function #22

Merged
Copilot merged 2 commits from copilot/fix-terminal-log-errors into main 2025-11-17 21:53:37 -06:00
Copilot commented 2025-11-17 21:45:38 -06:00 (Migrated from github.com)

Application crashes when closing embedded browser views due to calling non-existent destroy() method on Electron BrowserView objects.

Changes

  • Removed invalid currentBrowserView.destroy() calls in three locations:
    • Window close handler (line 116)
    • createBrowserView() cleanup (line 128)
    • close-browser IPC handler (line 220)

Fix

BrowserView cleanup only requires removeBrowserView() and nullifying the reference:

// Before (crashes)
if (currentBrowserView) {
  mainWindow.removeBrowserView(currentBrowserView);
  currentBrowserView.destroy();  // TypeError: destroy is not a function
  currentBrowserView = null;
}

// After (works)
if (currentBrowserView) {
  mainWindow.removeBrowserView(currentBrowserView);
  currentBrowserView = null;
}

Note

GPU/WebGL errors in original issue are unrelated Chromium warnings and remain informational only.

Original prompt

This section details on the original issue you should resolve

<issue_title>terminal log output</issue_title>
<issue_description>[5804:1117/214438.529180:ERROR:components/viz/service/main/viz_main_impl.cc:189] Exiting GPU process due to errors during initialization
[5845:1117/214448.324760:ERROR:gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc:1091] [GroupMarkerNotSet(crbug.com/242999)!:A08041005C0F0000]Automatic fallback to software WebGL has been deprecated. Please use the --enable-unsafe-swiftshader (about:flags#enable-unsafe-swiftshader) flag to opt in to lower security guarantees for trusted content.
[5845:1117/214448.629624:ERROR:gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc:1091] [GroupMarkerNotSet(crbug.com/242999)!:A01023005C0F0000]Automatic fallback to software WebGL has been deprecated. Please use the --enable-unsafe-swiftshader (about:flags#enable-unsafe-swiftshader) flag to opt in to lower security guarantees for trusted content.
[5845:1117/214448.704263:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels
[5845:1117/214448.760955:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels
[5845:1117/214448.908234:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels
[5845:1117/214449.002989:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels (this message will no longer repeat)
Error occurred in handler for 'close-browser': TypeError: currentBrowserView.destroy is not a function
at /home/localadmin/castroix/main.js:220:24
at Session. (node:electron/js2c/browser_init:2:107286)
at Session.emit (node:events:519:28)
Error occurred in handler for 'close-browser': TypeError: currentBrowserView.destroy is not a function
at /home/localadmin/castroix/main.js:220:24
at Session. (node:electron/js2c/browser_init:2:107286)
at Session.emit (node:events:519:28)
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Application crashes when closing embedded browser views due to calling non-existent `destroy()` method on Electron `BrowserView` objects. ### Changes - Removed invalid `currentBrowserView.destroy()` calls in three locations: - Window close handler (line 116) - `createBrowserView()` cleanup (line 128) - `close-browser` IPC handler (line 220) ### Fix `BrowserView` cleanup only requires `removeBrowserView()` and nullifying the reference: ```javascript // Before (crashes) if (currentBrowserView) { mainWindow.removeBrowserView(currentBrowserView); currentBrowserView.destroy(); // TypeError: destroy is not a function currentBrowserView = null; } // After (works) if (currentBrowserView) { mainWindow.removeBrowserView(currentBrowserView); currentBrowserView = null; } ``` ### Note GPU/WebGL errors in original issue are unrelated Chromium warnings and remain informational only. <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>terminal log output</issue_title> > <issue_description>[5804:1117/214438.529180:ERROR:components/viz/service/main/viz_main_impl.cc:189] Exiting GPU process due to errors during initialization > [5845:1117/214448.324760:ERROR:gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc:1091] [GroupMarkerNotSet(crbug.com/242999)!:A08041005C0F0000]Automatic fallback to software WebGL has been deprecated. Please use the --enable-unsafe-swiftshader (about:flags#enable-unsafe-swiftshader) flag to opt in to lower security guarantees for trusted content. > [5845:1117/214448.629624:ERROR:gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc:1091] [GroupMarkerNotSet(crbug.com/242999)!:A01023005C0F0000]Automatic fallback to software WebGL has been deprecated. Please use the --enable-unsafe-swiftshader (about:flags#enable-unsafe-swiftshader) flag to opt in to lower security guarantees for trusted content. > [5845:1117/214448.704263:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels > [5845:1117/214448.760955:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels > [5845:1117/214448.908234:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels > [5845:1117/214449.002989:ERROR:gpu/command_buffer/service/gl_utils.cc:389] [.WebGL-0xe7400132000]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels (this message will no longer repeat) > Error occurred in handler for 'close-browser': TypeError: currentBrowserView.destroy is not a function > at /home/localadmin/castroix/main.js:220:24 > at Session.<anonymous> (node:electron/js2c/browser_init:2:107286) > at Session.emit (node:events:519:28) > Error occurred in handler for 'close-browser': TypeError: currentBrowserView.destroy is not a function > at /home/localadmin/castroix/main.js:220:24 > at Session.<anonymous> (node:electron/js2c/browser_init:2:107286) > at Session.emit (node:events:519:28) > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> - Fixes SluberskiHomeLab/castroix#21 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
SluberskiHomeLab (Migrated from github.com) reviewed 2025-11-17 21:45:38 -06:00
Sign in to join this conversation.
No description provided.