Commit 8e0e9501 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix leak and ensure m_* prefix usage

parent eb97a287
......@@ -8,7 +8,6 @@
#include "gitutils.h"
#include <QCoreApplication>
#include <QFutureWatcher>
#include <QKeyEvent>
#include <QLineEdit>
#include <QPainter>
......@@ -194,8 +193,7 @@ BranchesDialog::BranchesDialog(QWidget *parent, KTextEditor::MainWindow *mainWin
setHidden(true);
checkoutWatcher = new QFutureWatcher<GitUtils::CheckoutResult>();
connect(checkoutWatcher, &QFutureWatcher<GitUtils::CheckoutResult>::finished, this, &BranchesDialog::onCheckoutDone);
connect(&m_checkoutWatcher, &QFutureWatcher<GitUtils::CheckoutResult>::finished, this, &BranchesDialog::onCheckoutDone);
}
void BranchesDialog::openDialog()
......@@ -250,7 +248,7 @@ bool BranchesDialog::eventFilter(QObject *obj, QEvent *event)
void BranchesDialog::onCheckoutDone()
{
const GitUtils::CheckoutResult res = checkoutWatcher->result();
const GitUtils::CheckoutResult res = m_checkoutWatcher.result();
auto msgType = KTextEditor::Message::Positive;
QString msgStr = i18n("Branch %1 checked out", res.branch);
if (res.returnCode > 0) {
......@@ -272,7 +270,7 @@ void BranchesDialog::slotReturnPressed()
{
const auto branch = m_proxyModel->data(m_treeView->currentIndex(), BranchesDialogModel::CheckoutName).toString();
QFuture<GitUtils::CheckoutResult> future = QtConcurrent::run(&GitUtils::checkoutBranch, m_projectPath, branch);
checkoutWatcher->setFuture(future);
m_checkoutWatcher.setFuture(future);
m_lineEdit->clear();
hide();
......
......@@ -3,6 +3,7 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include <QFutureWatcher>
#include <QMenu>
class QTreeView;
......@@ -11,7 +12,6 @@ class BranchesDialogModel;
class QAction;
class BranchFilterModel;
class KActionCollection;
template<typename T> class QFutureWatcher;
namespace KTextEditor
{
......@@ -51,5 +51,5 @@ private:
BranchFilterModel *m_proxyModel;
KTextEditor::MainWindow *m_mainWindow;
QString m_projectPath;
QFutureWatcher<GitUtils::CheckoutResult> *checkoutWatcher;
QFutureWatcher<GitUtils::CheckoutResult> m_checkoutWatcher;
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment