Lagrange [work/v1.10]

Bookmarks: Fixed crash when removing a bookmark source

=> abe1309ddc0d5cbb73dec4d23237d847b7d73f7f

diff --git a/src/bookmarks.c b/src/bookmarks.c
index 2efdc873..1fc24a67 100644
--- a/src/bookmarks.c
+++ b/src/bookmarks.c
@@ -214,6 +214,17 @@ iBool remove_Bookmarks(iBookmarks *d, uint32_t id) {
     lock_Mutex(d->mtx);
     iBookmark *bm = (iBookmark *) remove_Hash(&d->bookmarks, id);
     if (bm) {
+        /* If this is a remote source, make sure all the remote bookmarks are
+           removed as well. */
+        if (hasTag_Bookmark(bm, "remotesource")) {
+            iForEach(Hash, i, &d->bookmarks) {
+                iBookmark *j = (iBookmark *) i.value;
+                if (j->sourceId == id_Bookmark(bm)) {
+                    remove_HashIterator(&i);
+                    delete_Bookmark(j);
+                }
+            }
+        }
         delete_Bookmark(bm);
     }
     unlock_Mutex(d->mtx);
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.10/cdiff/abe1309ddc0d5cbb73dec4d23237d847b7d73f7f
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
390.473718 milliseconds
Gemini-to-HTML Time
0.563354 milliseconds

This content has been proxied by September (ba2dc).