DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit d290ac2fe07117e74cea1c50a95c21dc1e039b47
parent c6d942049090d7623bb2eaa6e406136d52e6d0df
Author: falkTX <falktx@falktx.com>
Date:   Fri, 12 Nov 2021 16:34:07 +0000

Fix DBus file dialog for Gtk/GNOME

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/extra/FileBrowserDialog.cpp | 21+++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/distrho/extra/FileBrowserDialog.cpp b/distrho/extra/FileBrowserDialog.cpp @@ -473,12 +473,29 @@ bool fileBrowserIdle(const FileBrowserHandle handle) DBusMessageIter dict; dbus_message_iter_recurse(&dictArray, &dict); - // start with the string "uris" + // look for dict with string "uris" DISTRHO_SAFE_ASSERT_BREAK(dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_STRING); const char* key = nullptr; dbus_message_iter_get_basic(&dict, &key); - DISTRHO_SAFE_ASSERT_BREAK(key != nullptr && std::strcmp(key, "uris") == 0); + DISTRHO_SAFE_ASSERT_BREAK(key != nullptr); + + // keep going until we find it + while (std::strcmp(key, "uris") != 0) + { + key = nullptr; + dbus_message_iter_next(&dictArray); + DISTRHO_SAFE_ASSERT_BREAK(dbus_message_iter_get_arg_type(&dictArray) == DBUS_TYPE_DICT_ENTRY); + + dbus_message_iter_recurse(&dictArray, &dict); + DISTRHO_SAFE_ASSERT_BREAK(dbus_message_iter_get_arg_type(&dict) == DBUS_TYPE_STRING); + + dbus_message_iter_get_basic(&dict, &key); + DISTRHO_SAFE_ASSERT_BREAK(key != nullptr); + } + + if (key == nullptr) + break; // then comes variant dbus_message_iter_next(&dict);