mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
clean closing of app
problem occured because of parent-child relationship
This commit is contained in:
parent
03dc6e09b5
commit
4da5327bb0
105
gui/main.js
105
gui/main.js
|
@ -229,9 +229,14 @@ function createWindow() {
|
|||
|
||||
// Emitted when the window is closed.
|
||||
win.on('closed', function() {
|
||||
console.log("closing all windows.....")
|
||||
/*
|
||||
win = null;
|
||||
chat = null;
|
||||
logViewer = null;
|
||||
*/
|
||||
close_all();
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
@ -357,52 +362,10 @@ app.whenReady().then(() => {
|
|||
})
|
||||
})
|
||||
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
||||
|
||||
// closing the tnc binary if not closed when closing application and also our daemon which has been started by the gui
|
||||
try {
|
||||
daemonProcess.kill();
|
||||
} catch (e) {
|
||||
mainLog.error(e)
|
||||
}
|
||||
|
||||
close_all();
|
||||
|
||||
mainLog.warn('closing tnc');
|
||||
|
||||
if(os.platform()=='win32' || os.platform()=='win64'){
|
||||
exec('Taskkill', ['/IM', 'freedata-tnc.exe', '/F'])
|
||||
}
|
||||
|
||||
if(os.platform()=='linux'){
|
||||
|
||||
exec('pkill', ['-9', 'freedata-tnc'])
|
||||
|
||||
// on macOS we need to kill the daemon as well. If we are not doing this,
|
||||
// the daemon wont startup again because the socket is already in use
|
||||
//for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there...
|
||||
exec('pkill', ['-9', 'freedata-daemon'])
|
||||
}
|
||||
|
||||
if(os.platform()=='darwin'){
|
||||
|
||||
exec('pkill', ['-9', 'freedata-tnc'])
|
||||
|
||||
// on macOS we need to kill the daemon as well. If we are not doing this,
|
||||
// the daemon wont startup again because the socket is already in use
|
||||
//for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there...
|
||||
exec('pkill', ['-9', 'freedata-daemon'])
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
*/
|
||||
mainLog.warn('quitting app');
|
||||
app.quit();
|
||||
|
||||
})
|
||||
|
||||
// IPC HANDLER
|
||||
|
@ -610,3 +573,57 @@ autoUpdater.on('error', (error) => {
|
|||
|
||||
|
||||
|
||||
function close_all() {
|
||||
|
||||
// function for closing the application with closing all used processes
|
||||
|
||||
// closing the tnc binary if not closed when closing application and also our daemon which has been started by the gui
|
||||
try {
|
||||
daemonProcess.kill();
|
||||
} catch (e) {
|
||||
mainLog.error(e)
|
||||
}
|
||||
|
||||
|
||||
mainLog.warn('closing tnc');
|
||||
|
||||
if(os.platform()=='win32' || os.platform()=='win64'){
|
||||
exec('Taskkill', ['/IM', 'freedata-tnc.exe', '/F'])
|
||||
}
|
||||
|
||||
if(os.platform()=='linux'){
|
||||
|
||||
exec('pkill', ['-9', 'freedata-tnc'])
|
||||
|
||||
// on macOS we need to kill the daemon as well. If we are not doing this,
|
||||
// the daemon wont startup again because the socket is already in use
|
||||
//for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there...
|
||||
exec('pkill', ['-9', 'freedata-daemon'])
|
||||
}
|
||||
|
||||
if(os.platform()=='darwin'){
|
||||
|
||||
exec('pkill', ['-9', 'freedata-tnc'])
|
||||
|
||||
// on macOS we need to kill the daemon as well. If we are not doing this,
|
||||
// the daemon wont startup again because the socket is already in use
|
||||
//for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there...
|
||||
exec('pkill', ['-9', 'freedata-daemon'])
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
*/
|
||||
mainLog.warn('quitting app');
|
||||
|
||||
win.destroy();
|
||||
chat.destroy();
|
||||
logViewer.destroy();
|
||||
|
||||
app.quit();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "FreeDATA",
|
||||
"version": "0.3.0-alpha.6",
|
||||
"version": "0.3.0-alpha.7",
|
||||
"description": "FreeDATA ",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -96,7 +96,6 @@ def fetch_audio_devices(input_devices, output_devices):
|
|||
sd._terminate()
|
||||
sd._initialize()
|
||||
|
||||
|
||||
devices = sd.query_devices(device=None, kind=None)
|
||||
index = 0
|
||||
for device in devices:
|
||||
|
@ -108,6 +107,7 @@ def fetch_audio_devices(input_devices, output_devices):
|
|||
#maxOutputChannels = p.get_device_info_by_host_api_device_index(0, i).get('maxOutputChannels')
|
||||
#name = p.get_device_info_by_host_api_device_index(0, i).get('name')
|
||||
name = device["name"]
|
||||
|
||||
maxOutputChannels = device["max_output_channels"]
|
||||
maxInputChannels = device["max_input_channels"]
|
||||
|
||||
|
|
Loading…
Reference in a new issue