After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 623142 - Ensure ::new-connection runs before processing D-Bus messages
Ensure ::new-connection runs before processing D-Bus messages
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-06-29 14:44 UTC by David Zeuthen (not reading bugmail)
Modified: 2010-06-30 15:58 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Zeuthen (not reading bugmail) 2010-06-29 14:44:33 UTC
Currently we actually start handling incoming D-Bus messages before code in ::new-connection runs which isn't exactly ideal.

To fix this I think we're going to need

 gboolean g_dbus_connection_is_frozen ();
 void     g_dbus_connection_freeze()
 void     g_dbus_connection_thaw()

and a :frozen object property (with GObject::notify support). We're also going to need this

 /* If set, the newly created GDBusConnection will be frozen */
 G_DBUS_CONNECTION_FLAGS_FROZEN

With this API, GDBusServer will simply pass G_DBUS_CONNECTION_FLAGS_FROZEN when creating the new connection (in on_run()), run the ::new-connection signal (in an idle) and then thaw the connection. Simple as pie!
Comment 1 Allison Karlitskaya (desrt) 2010-06-29 19:36:35 UTC
would be better, I think, to have a GDBusConnectionFlag along the lines of _DELAY_MESSAGE_PROCESSING and a one-shot API call like g_dbus_connection_start_processing();
Comment 2 David Zeuthen (not reading bugmail) 2010-06-30 15:58:18 UTC
Fixed here using G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING and g_dbus_connection_start_message_processing(). I also included a test case for this.

http://git.gnome.org/browse/glib/commit/?id=038d03cd08bdb42e6f83f6041ec01732476e900b