aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/models
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-07-18 23:06:59 +0200
committerRoland Knall <rknall@gmail.com>2019-07-19 07:07:35 +0000
commit2ab4aa4423fd1014e00ed2b1c36e7407722f57d6 (patch)
tree7950c26f68f18f610e9efe24bfd408405f715d5d /ui/qt/models
parent0428638a24f2616739cb795ff7ddddbf5b8a1424 (diff)
Qt: Delete copied profile proper
If a profile is a copy of another profile and get's deleted without being saved, the original profile got deleted Change-Id: Iffccb2e29131f97ad6fe71362946aad4e076eb3f Reviewed-on: https://code.wireshark.org/review/34011 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/models')
-rw-r--r--ui/qt/models/profile_model.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/ui/qt/models/profile_model.cpp b/ui/qt/models/profile_model.cpp
index ada4c8ba16..e0ec31ce5d 100644
--- a/ui/qt/models/profile_model.cpp
+++ b/ui/qt/models/profile_model.cpp
@@ -141,8 +141,13 @@ GList * ProfileModel::entry(profile_def *ref) const
GList *fl_entry = edited_profile_list();
while (fl_entry && fl_entry->data) {
profile_def *profile = reinterpret_cast<profile_def *>(fl_entry->data);
- if (strcmp(ref->reference, profile->reference) == 0 && ref->is_global == profile->is_global)
- return fl_entry;
+ if (strcmp(ref->name, profile->name) == 0 && ref->is_global == profile->is_global)
+ {
+ if ( ( ref->reference == Q_NULLPTR && profile->reference == Q_NULLPTR )
+ || ( ( ref->reference != Q_NULLPTR && profile->reference != Q_NULLPTR )
+ && (strcmp(ref->reference, profile->reference) == 0) ) )
+ return fl_entry;
+ }
fl_entry = gxx_list_next(fl_entry);
}
@@ -532,10 +537,11 @@ void ProfileModel::deleteEntry(QModelIndex idx)
else
{
GList * fl_entry = entry(prof);
- emit beginRemoveRows(QModelIndex(), idx.row(), idx.row());
- remove_from_profile_list(fl_entry);
- emit endRemoveRows();
- loadProfiles();
+ if ( fl_entry )
+ {
+ remove_from_profile_list(fl_entry);
+ loadProfiles();
+ }
}
}