mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 11:12:11 +01:00
bookmarkfile: Don't move an item if the uri has not changed
This was causing a crash, because we were first removing an item, freeing both the instance itself and the key, and then trying to reuse those. So, in this case, instead of reassigning an item, we can just return TRUE as we have already the item at the right place, while it's not needed to update the modified timestamp, since no modification happened in reality. Fixes #1588
This commit is contained in:
parent
e46739f18c
commit
5c6f185e9b
@ -3528,6 +3528,9 @@ g_bookmark_file_move_item (GBookmarkFile *bookmark,
|
|||||||
|
|
||||||
if (new_uri && new_uri[0] != '\0')
|
if (new_uri && new_uri[0] != '\0')
|
||||||
{
|
{
|
||||||
|
if (g_strcmp0 (old_uri, new_uri) == 0)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
if (g_bookmark_file_has_item (bookmark, new_uri))
|
if (g_bookmark_file_has_item (bookmark, new_uri))
|
||||||
{
|
{
|
||||||
if (!g_bookmark_file_remove_item (bookmark, new_uri, error))
|
if (!g_bookmark_file_remove_item (bookmark, new_uri, error))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user