diff options
author | 2012-05-17 20:50:47 +0200 | |
---|---|---|
committer | 2012-05-17 20:50:47 +0200 | |
commit | 816d87e1d38dc0fecbe1fa47794b2d7a18d2e321 (patch) | |
tree | 6753620029a94976bf27d474156723dd2f403813 /plugins/gtkui/plcommon.c | |
parent | af55e42f2422f8734bc80fb8a58eba80b29937ef (diff) |
fixed many calls to pl_find_meta[_raw] being called without pl_lock;
added debug pl_ensure_lock function which asserts when pl_lock is not set when it is required;
added new API functions for thread-safe metadata access
Diffstat (limited to 'plugins/gtkui/plcommon.c')
-rw-r--r-- | plugins/gtkui/plcommon.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 406b2f16..f0c36a24 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -256,8 +256,16 @@ main_reload_metadata_activate DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (menuitem), "ps")); DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); while (it) { - const char *decoder_id = deadbeef->pl_find_meta (it, ":DECODER"); - if (deadbeef->pl_is_selected (it) && deadbeef->is_local_file (deadbeef->pl_find_meta (it, ":URI")) && decoder_id) { + deadbeef->pl_lock (); + char decoder_id[100]; + const char *dec = deadbeef->pl_find_meta (it, ":DECODER"); + if (dec) { + strncpy (decoder_id, dec, sizeof (decoder_id)); + } + int match = deadbeef->pl_is_selected (it) && deadbeef->is_local_file (deadbeef->pl_find_meta (it, ":URI")) && dec; + deadbeef->pl_unlock (); + + if (match) { uint32_t f = deadbeef->pl_get_item_flags (it); if (!(f & DDB_IS_SUBTRACK)) { f &= ~DDB_TAG_MASK; |