fix: segfault when moving WebContentsView between BrowserWindows (#44599)

* fix: segfault when moving WebContentsView between BrowserWindows

* chore: actually enable fix

* fixup segfault when moving WebContentsView between BrowserWindows
This commit is contained in:
John Kleinschmidt 2024-11-11 18:44:13 -05:00 committed by GitHub
parent c6c430bff1
commit 777e547922
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 58 additions and 1 deletions

View file

@ -0,0 +1,31 @@
const { app, BrowserWindow, WebContentsView } = require('electron');
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow();
const secondaryWindow = new BrowserWindow();
const contentsView = new WebContentsView();
mainWindow.contentView.addChildView(contentsView);
mainWindow.webContents.setDevToolsWebContents(contentsView.webContents);
mainWindow.openDevTools();
contentsView.setBounds({
x: 400,
y: 0,
width: 400,
height: 600
});
setTimeout(() => {
secondaryWindow.contentView.addChildView(contentsView);
setTimeout(() => {
mainWindow.contentView.addChildView(contentsView);
app.quit();
}, 1000);
}, 1000);
}
app.whenReady().then(() => {
createWindow();
});