]> git.armaanb.net Git - chorizo.git/commitdiff
Deal with race conditions while embedding
authorPeter Hofmann <scm@uninformativ.de>
Sat, 14 Jun 2014 19:57:04 +0000 (21:57 +0200)
committerPeter Hofmann <scm@uninformativ.de>
Sat, 14 Jun 2014 19:57:04 +0000 (21:57 +0200)
I have not encountered any race conditions. In theory, they could
happen, though.

zea.c

diff --git a/zea.c b/zea.c
index 6ffe99431af5bc7bf91c60ed0dddea90d11c68f2..22be5e8780690403cb2be1390017214b443fea1f 100644 (file)
--- a/zea.c
+++ b/zea.c
@@ -230,6 +230,15 @@ zea_new_client(const gchar *uri)
        else
        {
                c->win = gtk_plug_new(embed);
+               while (!gtk_plug_get_embedded(GTK_PLUG(c->win)))
+               {
+                       fprintf(stderr, "zea: Not yet embedded! Waiting a second...\n");
+                       sleep(1);
+
+                       if (c->win != NULL)
+                               gtk_widget_destroy(c->win);
+                       c->win = gtk_plug_new(embed);
+               }
        }
 
        /* When using Gtk2, zea only shows a white area when run in