mirror of
https://github.com/occ-ai/obs-localvocal
synced 2024-11-07 18:57:14 +00:00
Fix model downloader crash on shutdown (#155)
* 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
This commit is contained in:
parent
bdab41cafc
commit
12fa9dce65
@ -66,8 +66,10 @@ void ModelDownloader::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
if (!this->mPrepareToClose)
|
||||
e->ignore();
|
||||
else
|
||||
else {
|
||||
QDialog::closeEvent(e);
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
void ModelDownloader::close()
|
||||
|
@ -50,8 +50,8 @@ protected:
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user