[gnome-code-assistance] [backends/go] Fix deadlock in unexporting objects



commit 8ad519983c1901070cc63c887f3650713f2f1236
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Fri Nov 15 01:02:59 2013 +0100

    [backends/go] Fix deadlock in unexporting objects

 backends/go/transport_dbus.go |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/backends/go/transport_dbus.go b/backends/go/transport_dbus.go
index c292972..2e5f9ba 100644
--- a/backends/go/transport_dbus.go
+++ b/backends/go/transport_dbus.go
@@ -28,11 +28,14 @@ func NewDbusError(name string, format string, args ...interface{}) *dbus.Error {
 func (t *TransportDbus) unexport(obj ObjectDbus, p dbus.ObjectPath) {
        n := obj.Introspect()
 
-       for _, i := range n.Interfaces {
-               t.conn.Export(nil, p, i.Name)
-       }
+       // Prevent deadlock when called from exported methods
+       go func() {
+               for _, i := range n.Interfaces {
+                       t.conn.Export(nil, p, i.Name)
+               }
 
-       t.conn.Export(nil, p, "org.freedesktop.DBus.Introspectable")
+               t.conn.Export(nil, p, "org.freedesktop.DBus.Introspectable")
+       }()
 }
 
 func (t *TransportDbus) export(obj ObjectDbus, p dbus.ObjectPath) error {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]