File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ namespace {
21
21
22
22
const QString kLinkFmt = " <a href='%1'>%2</a>" ;
23
23
24
+ class Lock {
25
+ public:
26
+ Lock (bool &var) : mVar (var) { var = true ; }
27
+ ~Lock () { mVar = false ; }
28
+
29
+ private:
30
+ bool &mVar ;
31
+ };
32
+
24
33
} // namespace
25
34
26
35
DiffTreeModel::DiffTreeModel (const git::Repository &repo, QObject *parent)
@@ -51,6 +60,8 @@ void DiffTreeModel::setDiff(const git::Diff &diff) {
51
60
}
52
61
53
62
void DiffTreeModel::refresh (const QStringList &paths) {
63
+ if (suppressRefresh)
64
+ return ;
54
65
for (auto path : paths) {
55
66
auto index = this ->index (path);
56
67
emit dataChanged (index , index , {Qt::CheckStateRole});
@@ -288,6 +299,8 @@ bool DiffTreeModel::discard(const QModelIndex &index) {
288
299
289
300
bool DiffTreeModel::setData (const QModelIndex &index, const QVariant &value,
290
301
int role, bool ignoreIndexChanges) {
302
+
303
+ Lock l (suppressRefresh);
291
304
switch (role) {
292
305
case Qt::CheckStateRole: {
293
306
QStringList files;
Original file line number Diff line number Diff line change @@ -160,6 +160,7 @@ class DiffTreeModel : public QAbstractItemModel {
160
160
git::Repository mRepo ;
161
161
162
162
bool mListView = false ;
163
+ bool suppressRefresh{false };
163
164
};
164
165
165
166
#endif /* DIFFTREEMODEL */
You can’t perform that action at this time.
0 commit comments