Fix memory leaks

This commit is contained in:
Jonas Kvinge
2019-07-22 20:53:05 +02:00
parent 2df21081a1
commit bd78e8c275
33 changed files with 186 additions and 74 deletions

View File

@@ -399,8 +399,7 @@ void Playlist::SongSaveComplete(TagReaderReply *reply, const QPersistentModelInd
emit Error(tr("An error occurred writing metadata to '%1'").arg(QString::fromStdString(reply->request_message().save_file_request().filename())));
}
}
metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
reply->deleteLater();
}

View File

@@ -395,12 +395,17 @@ TagCompleter::TagCompleter(CollectionBackend *backend, Playlist::Column column,
}
TagCompleter::~TagCompleter() {
delete model();
}
void TagCompleter::ModelReady(QFuture<TagCompletionModel*> future) {
TagCompletionModel *model = future.result();
setModel(model);
setCaseSensitivity(Qt::CaseInsensitive);
editor_->setCompleter(this);
}
QWidget *TagCompletionItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const {
@@ -409,6 +414,7 @@ QWidget *TagCompletionItemDelegate::createEditor(QWidget *parent, const QStyleOp
new TagCompleter(backend_, column_, editor);
return editor;
}
QString NativeSeparatorsDelegate::displayText(const QVariant &value, const QLocale&) const {

View File

@@ -144,6 +144,7 @@ class TagCompleter : public QCompleter {
public:
TagCompleter(CollectionBackend *backend, Playlist::Column column, QLineEdit *editor);
~TagCompleter();
private slots:
void ModelReady(QFuture<TagCompletionModel*> future);