Skip to content

Commit

Permalink
Fix model downloader crash on shutdown (#155)
Browse files Browse the repository at this point in the history
* Fix `ModelDownloader` not being aware of child object deletions

* Delete `ModelDownloader` after it's done processing

Otherwise this is only deleted when OBS exits, effectively leaking
memory
  • Loading branch information
palana authored Aug 20, 2024
1 parent bdab41c commit 12fa9dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/model-utils/model-downloader-ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ void ModelDownloader::closeEvent(QCloseEvent *e)
{
if (!this->mPrepareToClose)
e->ignore();
else
else {
QDialog::closeEvent(e);
deleteLater();
}
}

void ModelDownloader::close()
Expand Down
4 changes: 2 additions & 2 deletions src/model-utils/model-downloader-ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public slots:
private:
QVBoxLayout *layout;
QProgressBar *progress_bar;
QThread *download_thread;
ModelDownloadWorker *download_worker;
QPointer<QThread> download_thread;
QPointer<ModelDownloadWorker> download_worker;
// Callback for when the download is finished
download_finished_callback_t download_finished_callback;
bool mPrepareToClose;
Expand Down

0 comments on commit 12fa9dc

Please sign in to comment.