mirror of
https://github.com/rubickCenter/rubick
synced 2026-03-10 16:00:16 +08:00
🐛 修复销毁 BrowserView 的bug
This commit is contained in:
@@ -54,6 +54,7 @@ export default () => {
|
||||
executeHooks('PluginOut', null);
|
||||
});
|
||||
createWin.on('closed', () => {
|
||||
view.webContents?.destroy();
|
||||
win = undefined;
|
||||
});
|
||||
createWin.on('focus', () => {
|
||||
@@ -70,6 +71,7 @@ export default () => {
|
||||
);
|
||||
view.setAutoResize({ width: true, height: true });
|
||||
createWin.setBrowserView(view);
|
||||
view.inDetach = true;
|
||||
createWin.webContents.executeJavaScript(
|
||||
`window.initDetach(${JSON.stringify(pluginInfo)})`
|
||||
);
|
||||
|
||||
@@ -166,8 +166,11 @@ export default () => {
|
||||
const removeView = (window: BrowserWindow) => {
|
||||
if (!view) return;
|
||||
window.removeBrowserView(view);
|
||||
window.setBrowserView(null);
|
||||
view.webContents.destroy();
|
||||
if (!view.inDetach) {
|
||||
window.setBrowserView(null);
|
||||
view.webContents?.destroy();
|
||||
}
|
||||
|
||||
// window.setSize(800, 60);
|
||||
executeHooks('PluginOut', null);
|
||||
window.webContents?.executeJavaScript(`window.initRubick()`);
|
||||
|
||||
Reference in New Issue
Block a user