Fix timer errors on exit
The NetworkRemote is moved to a new thread after creation. On that thread, its child classes create timers. When the network remote class is deleted on the main thread, we see "Timers cannot be stopped from another thread". To avoid this error, use deleteLater to delete NetworkRemote and its composition classes on its own thread.
This commit is contained in:
parent
5b918a70aa
commit
8f56fbb83b
|
@ -142,11 +142,15 @@ class ApplicationImpl {
|
|||
return nullptr;
|
||||
#endif
|
||||
}),
|
||||
network_remote_([=]() {
|
||||
NetworkRemote* remote = new NetworkRemote(app);
|
||||
app->MoveToNewThread(remote);
|
||||
return remote;
|
||||
}),
|
||||
// Since NetworkRemote is moved to a different thread and creates
|
||||
// timers there, it should also be deleted on that thread.
|
||||
network_remote_(
|
||||
[=]() {
|
||||
NetworkRemote* remote = new NetworkRemote(app);
|
||||
app->MoveToNewThread(remote);
|
||||
return remote;
|
||||
},
|
||||
[=](NetworkRemote* remote) { remote->deleteLater(); }),
|
||||
network_remote_helper_([=]() { return new NetworkRemoteHelper(app); }),
|
||||
scrobbler_([=]() {
|
||||
#ifdef HAVE_LIBLASTFM
|
||||
|
|
Loading…
Reference in New Issue