Skip to content

Commit

Permalink
Discard history: only detach tags which are attached (#18248)
Browse files Browse the repository at this point in the history
* Discard history: only detach tags which are attached
* Discard history: release the connection when done
  • Loading branch information
kofa73 authored Jan 20, 2025
1 parent 1728c59 commit 64939cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/common/tags.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ gboolean dt_tag_detach_by_string(const char *name,
"SELECT tagid"
" FROM main.tagged_images as ti, data.tags as t"
" WHERE ti.tagid = t.id"
" AND t.name GLOB ?1",
" AND t.name GLOB ?1"
" AND ti.imgid = ?2",
-1, &stmt,
NULL);

Expand All @@ -661,6 +662,7 @@ gboolean dt_tag_detach_by_string(const char *name,
}

DT_DEBUG_SQLITE3_BIND_TEXT(stmt, 1, n, -1, SQLITE_TRANSIENT);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, imgid);

gboolean res = FALSE;

Expand All @@ -671,6 +673,8 @@ gboolean dt_tag_detach_by_string(const char *name,
dt_tag_detach(tagid, imgid, undo_on, group_on);
}

sqlite3_finalize(stmt);

g_free(n);

return res;
Expand Down

0 comments on commit 64939cc

Please sign in to comment.