Fix GLib assertion failure in media.c get_setting()

If get_setting is called before set_setting, mp->settings would be
NULL resulting in GLib assertion. Hashmap is now allocated in
media_player_create instead of on-demand allocation in set_setting.

external/bluetooth/bluez/audio/media.c:get_setting() Equalizer
CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed
This commit is contained in:
Szymon Janc 2012-02-02 23:21:19 +01:00 committed by Johan Hedberg
parent c2452f3d45
commit 1b44684fb0

View File

@ -1371,9 +1371,6 @@ static gboolean set_property(struct media_player *mp, const char *key,
DBG("%s=%s", key, value);
if (!mp->settings)
mp->settings = g_hash_table_new(g_direct_hash, g_direct_equal);
g_hash_table_replace(mp->settings, GUINT_TO_POINTER(attr),
GUINT_TO_POINTER(val));
@ -1595,6 +1592,8 @@ static struct media_player *media_player_create(struct media_adapter *adapter,
return NULL;
}
mp->settings = g_hash_table_new(g_direct_hash, g_direct_equal);
adapter->players = g_slist_append(adapter->players, mp);
info("Player registered: sender=%s path=%s", sender, path);