YIO-Remote / remote-software

💎 YIO Remote Software repository
GNU General Public License v3.0
164 stars 21 forks source link

App doesn't terminate gracefully and crashes #337

Closed zehnm closed 4 years ago

zehnm commented 4 years ago

Expected behavior When running the app on Linux, macOS or Windows it can be gracefully terminated without throwing errors.

Current behavior On macOs an error dialog is shown when closing the app saying it crashed. Error messages are shown in the console on every platform.

Detailed description Console messages:

FATAL: yio QThread: Destroyed while thread is still running (/0)
19:53:54: The program has unexpectedly finished.
19:53:54: The process was ended forcefully.

Crash dialog on macOS:

Screenshot 2019-11-21 at 20 02 32
zehnm commented 4 years ago

One issue is in BluetoothArea:

zehnm commented 4 years ago

Quick fix without checking if the thread has been started or not:

BluetoothArea::~BluetoothArea() {
    m_thread.exit();
    m_thread.wait();
}

The Bluetooth thread exits and the FATAL QThread error is gone, BUT the app crashes now with a segmentation fault within the Logger because the instance has already been deleted but other parts are still active and continue logging...

@ChristianRiedl could you make the Logger instance a global object, or do you have a better idea? Right now it's created in main() and is therefore removed too early during application shutdown.

zehnm commented 4 years ago

Next issue: DockThread in DockBase (same as BluetoothThread)

martonborzak commented 4 years ago

I think that is true for all threaded things

Sent from my phone

On 22 Nov 2019, at 17.34, Markus Zehnder notifications@github.com wrote:

 Next issue: DockThread in DockBase (same as BluetoothThread)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zehnm commented 4 years ago

Got everything terminating gracefully without errors. After cleaning up the Wifi rewrite branch I'll add it to the dev branches of remote-software & integration projects.

martonborzak commented 4 years ago

Was this fixed already? @zehnm ?

zehnm commented 4 years ago

Yes, it was fixed with the WifiControl merge to dev.