Ensure asynchronous execution of window creation
Add `await` keyword to `createMainWindow` calls within app's 'ready' and 'activate' events to ensure the mainWindow is fully initialized before proceeding. This fix addresses potential race conditions where mainWindow could be used before being properly set up.
This commit is contained in:
1 parent
94250ae2f5
commit
105077f068
1 file changed
+3
-3
+3
-3
@@ -12,12 +12,12 @@ app.on('ready', async () => {
|
|||||||
}
|
}
|
||||||
macOSDisableDefaultMenuItem()
|
macOSDisableDefaultMenuItem()
|
||||||
|
|
||||||
mainWindow = createMainWindow(mainWindow)
|
mainWindow = await createMainWindow(mainWindow)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('activate', () => {
|
app.on('activate', async () => {
|
||||||
if (!mainWindow) {
|
if (!mainWindow) {
|
||||||
mainWindow = createMainWindow(mainWindow)
|
mainWindow = await createMainWindow(mainWindow)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user