Skip to content

Commit 04d6a5e

Browse files
committed
small bug fix
1 parent e594fee commit 04d6a5e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

electron_app/src/bridge.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function start_bridge() {
3131

3232

3333
if(! data.toString().includes("sdbk ")){
34-
if(win)
34+
if(win && !is_app_closing )
3535
win.webContents.send('to_renderer', 'adlg ' + data.toString('utf8'));
3636
}
3737

@@ -46,7 +46,8 @@ function start_bridge() {
4646
if( splitted.length > 1 ){
4747
for (var i = 0; i < splitted.length -1 ; i++) {
4848
if (splitted[i].length > 0)
49-
win.webContents.send('to_renderer', 'py2b ' + splitted[i]);
49+
if(win && !is_app_closing )
50+
win.webContents.send('to_renderer', 'py2b ' + splitted[i]);
5051
}
5152
}
5253

@@ -60,7 +61,7 @@ function start_bridge() {
6061

6162
python.stderr.on('data', (data) => {
6263
console.error(`stderr: ${data}`);
63-
if(win)
64+
if(win && !is_app_closing )
6465
win.webContents.send('to_renderer', 'adlg ' + data.toString('utf8') );
6566
});
6667

@@ -71,14 +72,19 @@ function start_bridge() {
7172
// }
7273

7374
if(is_app_closing){
74-
if (win)
75+
if (win){
7576
app.exit(1);
77+
}
7678
return;
7779
}
7880

7981
dialog.showMessageBox({ message: "Backend quit unexpectedly" });
8082
if (win)
83+
{
84+
is_app_closing = true;
8185
app.exit(1);
86+
}
87+
8288

8389
});
8490

0 commit comments

Comments
 (0)