com php/gtk-src: Improved gtk_init error handling: ex t/gtk+/php_gtk+.c

[email protected] (Elizabeth Marie Smith) Mon, 23 Jun 2014 18:07:41 +0000
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    4d8069ba86b23e0ece9086b735d1caad10906dc5=0AAuthor:    Patrick D.=
 Andersen <[email protected]>         Mon, 23 Jun 2014 14=
:07:41 -0400=0AParents:   2f32450597c01270a28a01d1159b51c958ed4e48=0ABranch=
es:  master=0A=0ALink:       http://git.php.net/?p=3Dphp/gtk-src.git;a=3Dco=
mmitdiff;h=3D4d8069ba86b23e0ece9086b735d1caad10906dc5=0A=0ALog:=0AImproved =
gtk_init error handling=0A=0AReplaced gtk_init_check with gtk_init_with_arg=
s so that we can return=0Athe actual GTK error if it fails instead of a gen=
eric error.=0A=0AChanged paths:=0A  M  ext/gtk+/php_gtk+.c=0A=0A=0ADiff:=0A=
diff --git a/ext/gtk+/php_gtk+.c b/ext/gtk+/php_gtk+.c=0Aindex 1e3b555..717=
0ccc 100644=0A--- a/ext/gtk+/php_gtk+.c=0A+++ b/ext/gtk+/php_gtk+.c=0A@@ -4=
4,6 +44,7 @@ static void init_gtk(TSRMLS_D)=0A =09char **argv =3D NULL;=0A =
=09int argc, i;=0A =09zend_bool no_argc =3D 0;=0A+=09GError  *error =3D NUL=
L;=0A =0A =09/*=0A =09 * Grab the argc/argv values from $_SERVER array.=0A@=
@ -90,13 +91,16 @@ static void init_gtk(TSRMLS_D)=0A =09   unloaded. */=0A =
=09//DL_LOAD("libgtk.so");=0A =09=09=09   =0A-=09if (!gtk_init_check(&argc,=
 &argv)) {=0A+=09// New error handler that passes the actual gtk_init error=
=0A+=0A+=09if (!gtk_init_with_args(&argc, &argv, NULL, NULL, NULL, &error))=
 {=0A =09=09if (argv !=3D NULL) {=0A =09=09=09for (i =3D 0; i < argc; i++)=
=0A =09=09=09=09g_free(argv[i]);=0A =09=09=09g_free(argv);=0A =09=09}=0A-=
=09=09php_error(E_ERROR, "php-gtk: Could not open display");=0A+=09=09php_e=
rror(E_ERROR, "%s", error->message);=0A+=09=09g_error_free (error);=0A =09=
=09return;=0A =09}=0A