Dive edit: don't free the taglist of the master dive

We do all of our edits on a copy of the dive - but the tag_list points to
the tag_list of the master dive (based on how we create that copy of the
master dive). So only free the tag_list if it is already different from
the master dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-03 18:04:39 -07:00
parent a12b10c008
commit c5437c7499

View file

@ -960,7 +960,8 @@ void MainTab::on_tagWidget_textChanged()
if (editMode == NONE)
return;
QString tag;
taglist_free(editedDive.tag_list);
if (editedDive.tag_list != current_dive->tag_list)
taglist_free(editedDive.tag_list);
editedDive.tag_list = NULL;
Q_FOREACH (tag, ui.tagWidget->getBlockStringList())
taglist_add_tag(&editedDive.tag_list, tag.toUtf8().data());