fix: potential "Object has been destroyed" error in BrowserWindow.getFocusedWindow (#35520)
This commit is contained in:
parent
c14f52aeb7
commit
b3a744db8a
1 changed files with 2 additions and 3 deletions
|
@ -72,9 +72,8 @@ BrowserWindow.getAllWindows = () => {
|
|||
|
||||
BrowserWindow.getFocusedWindow = () => {
|
||||
for (const window of BrowserWindow.getAllWindows()) {
|
||||
const hasWC = window.webContents && !window.webContents.isDestroyed();
|
||||
if (!window.isDestroyed() && hasWC) {
|
||||
if (window.isFocused() || window.isDevToolsFocused()) return window;
|
||||
if (!window.isDestroyed() && window.webContents && !window.webContents.isDestroyed()) {
|
||||
if (window.isFocused() || window.webContents.isDevToolsFocused()) return window;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue