Skip to content

Commit

Permalink
[plugins] Fixed a small bug in DBusServiceAdapter initialization
Browse files Browse the repository at this point in the history
dbus_service_adapter_new() ignored already existing tags. Usually
there are none, so it didn't really matter, but still...
  • Loading branch information
monich committed Jul 29, 2019
1 parent 2692aa4 commit 5b0ae27
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugins/dbus_service/dbus_service_adapter.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2018 Jolla Ltd.
* Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2018-2019 Jolla Ltd.
* Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand All @@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand Down Expand Up @@ -363,6 +363,7 @@ dbus_service_adapter_new(
GDBusConnection* connection)
{
DBusServiceAdapter* self = g_new0(DBusServiceAdapter, 1);
NfcTag** tags;
GError* error = NULL;

g_object_ref(self->connection = connection);
Expand Down Expand Up @@ -419,6 +420,11 @@ dbus_service_adapter_new(
g_signal_connect(self->iface, "handle-get-tags",
G_CALLBACK(dbus_service_adapter_handle_get_tags), self);

/* Initialize D-Bus context for existing tags (usually none) */
for (tags = adapter->tags; *tags; tags++) {
dbus_service_adapter_create_tag(self, *tags);
}

/* Export the interface */
if (g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON
(self->iface), connection, self->path, &error)) {
Expand Down

0 comments on commit 5b0ae27

Please sign in to comment.