Safely close database connections and delete backends
Also fix NewClosure leak caused by disconnected object signals
This commit is contained in:
@@ -95,7 +95,14 @@ SubsonicService::SubsonicService(Application *app, QObject *parent)
|
||||
}
|
||||
|
||||
SubsonicService::~SubsonicService() {
|
||||
collection_backend_->deleteLater();
|
||||
delete collection_backend_;
|
||||
}
|
||||
|
||||
void SubsonicService::Exit() {
|
||||
|
||||
connect(collection_backend_, SIGNAL(ExitFinished()), this, SIGNAL(ExitFinished()));
|
||||
collection_backend_->ExitAsync();
|
||||
|
||||
}
|
||||
|
||||
void SubsonicService::ShowConfig() {
|
||||
@@ -317,8 +324,8 @@ void SubsonicService::CheckConfiguration() {
|
||||
|
||||
void SubsonicService::ResetSongsRequest() {
|
||||
|
||||
if (songs_request_.get()) {
|
||||
disconnect(songs_request_.get(), 0, nullptr, 0);
|
||||
if (songs_request_.get()) { // WARNING: Don't disconnect everything. NewClosure() relies on destroyed()!!!
|
||||
disconnect(songs_request_.get(), 0, this, 0);
|
||||
disconnect(this, 0, songs_request_.get(), 0);
|
||||
songs_request_.reset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user