[tracker/wip/carlosg/portal: 41/47] libtracker-bus: Explicitly close sandbox sessions on connection close
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/portal: 41/47] libtracker-bus: Explicitly close sandbox sessions on connection close
- Date: Mon, 22 Jun 2020 08:23:48 +0000 (UTC)
commit 9a0e85155b20f1817fef45a7dd4dd363c283379d
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 24 16:01:54 2020 +0100
libtracker-bus: Explicitly close sandbox sessions on connection close
src/libtracker-bus/tracker-bus.vala | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index fab0402c5..2996bcf0a 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -21,6 +21,7 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
DBusConnection bus;
string dbus_name;
string object_path;
+ bool sandboxed;
private const string DBUS_PEER_IFACE = "org.freedesktop.DBus.Peer";
@@ -42,6 +43,7 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
public Connection (string dbus_name, string object_path, DBusConnection? dbus_connection) throws
Sparql.Error, IOError, DBusError, GLib.Error {
Object ();
+ this.sandboxed = false;
this.bus = dbus_connection;
// ensure that error domain is registered with GDBus
@@ -73,6 +75,7 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
this.dbus_name = PORTAL_NAME;
this.object_path = object_path;
+ this.sandboxed = true;
} else {
throw e;
}
@@ -324,9 +327,19 @@ public class Tracker.Bus.Connection : Tracker.Sparql.Connection {
}
public override void close () {
+ if (this.sandboxed) {
+ var message = new DBusMessage.method_call (PORTAL_NAME, PORTAL_PATH, PORTAL_IFACE,
"CloseSession");
+ message.set_body (new Variant ("(o)", this.object_path));
+
+ try {
+ this.bus.send_message (message, 0, null);
+ } catch (GLib.Error e) {
+ }
+ }
}
public async override bool close_async () throws GLib.IOError {
+ this.close ();
return true;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]