[hackers] [surf/surf-webkit2] Install Atoms before initializing gtk || Quentin Rameau

From: <git_AT_suckless.org>
Date: Wed, 22 Mar 2017 18:00:36 +0100 (CET)

commit 7e02344a615a61246ccce1c7f770e88fbd57756e
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Sun Feb 12 18:50:31 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Wed Mar 22 17:20:36 2017 +0100

    Install Atoms before initializing gtk
    
    There a race condition in gtkplug/socket which is raised when setting
    Atoms.
    Use this workaround until
    https://bugzilla.gnome.org/show_bug.cgi?id=778680 is fixed.

diff --git a/surf.c b/surf.c
index cd0a13c..93a1629 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -271,18 +271,20 @@ setup(void)
         if (signal(SIGHUP, sighup) == SIG_ERR)
                 die("Can't install SIGHUP handler");
 
- gtk_init(NULL, NULL);
-
- gdpy = gdk_display_get_default();
- dpy = GDK_DISPLAY_XDISPLAY(gdpy);
-
- curconfig = defconfig;
+ if (!(dpy = XOpenDisplay(NULL)))
+ die("Can't open default display");
 
         /* atoms */
         atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False);
         atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False);
         atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False);
 
+ gtk_init(NULL, NULL);
+
+ gdpy = gdk_display_get_default();
+
+ curconfig = defconfig;
+
         /* dirs and files */
         cookiefile = buildfile(cookiefile);
         scriptfile = buildfile(scriptfile);
_AT_@ -901,6 +903,7 @@ cleanup(void)
         g_free(scriptfile);
         g_free(stylefile);
         g_free(cachedir);
+ XCloseDisplay(dpy);
 }
 
 WebKitWebView *
Received on Wed Mar 22 2017 - 18:00:36 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 22 2017 - 18:12:27 CET