summaryrefslogtreecommitdiff
path: root/src/analysis/db
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-09-21 22:23:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-09-21 22:23:47 (GMT)
commit76fb13178cf6be94b8e01675b37f7cb1b92f7709 (patch)
treea6e6bbc6dde169add608097ceb5658fcb904bd08 /src/analysis/db
parentdfe76faf21e254c02c86a1b0b1f8ca8fc07fe027 (diff)
Defined lock mechanism for buffer caches.
Diffstat (limited to 'src/analysis/db')
-rw-r--r--src/analysis/db/items/bookmark.c4
-rw-r--r--src/analysis/db/items/comment.c11
-rw-r--r--src/analysis/db/items/switcher.c4
3 files changed, 12 insertions, 7 deletions
diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c
index a3da5b3..0a64c89 100644
--- a/src/analysis/db/items/bookmark.c
+++ b/src/analysis/db/items/bookmark.c
@@ -537,7 +537,7 @@ static bool g_db_bookmark_run(GDbBookmark *bookmark, GLoadedBinary *binary, bool
cache = g_loaded_binary_get_disassembly_cache(binary);
if (cache == NULL) goto exit;
- g_buffer_cache_lock(cache);
+ g_buffer_cache_wlock(cache);
/* Recherche de la ligne concernée */
@@ -565,7 +565,7 @@ static bool g_db_bookmark_run(GDbBookmark *bookmark, GLoadedBinary *binary, bool
/* Sortie */
- g_buffer_cache_unlock(cache);
+ g_buffer_cache_wunlock(cache);
g_object_unref(G_OBJECT(cache));
diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c
index 136b62b..bdff3a6 100644
--- a/src/analysis/db/items/comment.c
+++ b/src/analysis/db/items/comment.c
@@ -731,11 +731,12 @@ static bool g_db_comment_run(GDbComment *comment, GLoadedBinary *binary, bool ap
const mrange_t *range; /* Emplacement d'instruction */
size_t linked; /* Indice lié à traiter */
- result = true;
+ result = false;
cache = g_loaded_binary_get_disassembly_cache(binary);
+ if (cache == NULL) goto exit;
- g_buffer_cache_lock(cache);
+ g_buffer_cache_wlock(cache)
switch (comment->type)
{
@@ -813,10 +814,14 @@ static bool g_db_comment_run(GDbComment *comment, GLoadedBinary *binary, bool ap
}
- g_buffer_cache_unlock(cache);
+ g_buffer_cache_wunlock(cache);
g_object_unref(G_OBJECT(cache));
+ result = true;
+
+ exit:
+
return result;
}
diff --git a/src/analysis/db/items/switcher.c b/src/analysis/db/items/switcher.c
index 3ae9358..090b8ce 100644
--- a/src/analysis/db/items/switcher.c
+++ b/src/analysis/db/items/switcher.c
@@ -611,7 +611,7 @@ static bool g_db_switcher_run(GDbSwitcher *switcher, GLoadedBinary *binary, ImmO
cursor = g_binary_cursor_new();
g_binary_cursor_update(G_BINARY_CURSOR(cursor), &switcher->addr);
- g_buffer_cache_lock(cache);
+ g_buffer_cache_wlock(cache);
index = g_buffer_cache_find_index_by_cursor(cache, cursor, true);
@@ -630,7 +630,7 @@ static bool g_db_switcher_run(GDbSwitcher *switcher, GLoadedBinary *binary, ImmO
exit_gui:
- g_buffer_cache_unlock(cache);
+ g_buffer_cache_wunlock(cache);
g_object_unref(G_OBJECT(cache));