GNOME Bugzilla – Bug 767516
XInitThreads not called in empathy-call
Last modified: 2016-07-22 14:00:24 UTC
Created attachment 329590 [details] stack trace of the segfault I discovered when trying to test empathy-call that it segfaulted in __GI____pthread_mutex_lock nptl/pthread_mutex_lock.c I later discovered that XInitThreads wasn't being called because the guard condition to prevent calling it under wayland was always false. in empathy-call.c:main if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) is false until after g_object_context_parse is called. Unfortunately calling XInitThreads after that doesn't prevent the segfault. I replaced it with this check for wayland which did work under X. Though I haven't tested it under wayland yet. (I did the get the idea from a WIP patch for porting firefox to wayland.) if (!g_getenv("WAYLAND_DISPLAY")) { (I'm running on debian unstable, empathy-call built from git, using commit cb4d5c2b8023c2f2a9df1b8a9fb19f2af7d392be)
Created attachment 329591 [details] [review] proposed fix for wayland guard
Just tested this patch under GNOME wayland and was able to make a video call. Shockingly it seemed like all 4 streams actually connected - I had video in both directions and and audio. I only had video in one direction under X. I suspect I was just lucky. Regardless, there were no thread related crashes, so I think this should go in.
I don't think that is right. We don't want to depend on the WAYLAND_DISPLAY environment variable. The wayland socket is in a well-known location, and we will connect to it regardless whether WAYLAND_DISPLAY is set or not.
XInitThreads() initializes the library rather than a Display connection, and so it should be fine to call regardless of the display type.
Review of attachment 329591 [details] [review]: Setting the patch status as per comment 3 and comment 4
Created attachment 330288 [details] [review] Alwyas initialize X library I finally found some time to test Karl Tomlinson's suggestion and yes it appears to be safe to always call XInitThreads. Tried under GNOME Wayland and GNOME under X, empathy-call ran without immediately segfaulting, and sometimes would manage to negotiate video.
Thanks for investigating Diane and sorry about this. Let's just revert my change that broke it for no reason.
The following fix has been pushed: bd81961 Revert "Don't call XInitThreads in Wayland"
Created attachment 331950 [details] [review] Revert "Don't call XInitThreads in Wayland" This reverts commit a9ede294c57bc5738be3c33cba4ef88b9a7d4a0e. It causes empathy-call to crash when run in X11, and fixes absolutely nothing. See the bug for details. Thanks to Diane Trout for investigating and preparing a substantially- identical patch.