menu

Questions & Answers

Parent process crashes when opening two or more child windows

I have a problem, the following code (simple as it looks) does not allow me to open more than three windows (not counting the parent). The children work correctly, but the father crashes and doesn't let me continue. What I can do?

ipcMain.on('openNewWindow', function(event, arg) {
    windowEEE = new BrowserWindow({
        center: true,
        width: 1024,
        height: 720,
        minWidth: 1024,
        minHeight: 720,
        // show: false,
        icon: __dirname + '/resources/iconos/support.png',
        webPreferences: {
            nodeIntegration: true, // is default value after Electron v5
            contextIsolation: false, // protect against prototype pollution
            enableRemoteModule: true // turn off remote
        }
    })
    // windowEEE.setResizable(true);
    // windowEEE.setMenuBarVisibility(false)
    // windowEEE.once('ready-to-show', () => {
    //     windowEEE.show()
    // })
    windowEEE.loadFile(arg.html, {query: arg.query})
});

The logical thing is to open as many windows as one would like without any limit, but for some reason electronjs is hanging the parent process.

the function of call to ipcMain is

var openClient = (id) =>{
            ipcRenderer.sendSync('openNewWindow', {
              html:"./elements/components/equipo.html",
              query: { id : id }
            })
        }
     
Answers(1) :

Ok, sorry for asking. But the answer is that the ipc function had no return. Adding to it, event.returnValue = true worked.