Discussion:
com php/gtk-src: Improved gtk_init error handling: ext/gtk+/php_gtk+.c
Elizabeth Marie Smith
2014-06-23 18:07:41 UTC
Permalink
Commit: 4d8069ba86b23e0ece9086b735d1caad10906dc5
Author: Patrick D. Andersen <***@makoto-ub.scooby.doobies> Mon, 23 Jun 2014 14:07:41 -0400
Parents: 2f32450597c01270a28a01d1159b51c958ed4e48
Branches: master

Link: http://git.php.net/?p=php/gtk-src.git;a=commitdiff;h=4d8069ba86b23e0ece9086b735d1caad10906dc5

Log:
Improved gtk_init error handling

Replaced gtk_init_check with gtk_init_with_args so that we can return
the actual GTK error if it fails instead of a generic error.

Changed paths:
M ext/gtk+/php_gtk+.c


Diff:
diff --git a/ext/gtk+/php_gtk+.c b/ext/gtk+/php_gtk+.c
index 1e3b555..7170ccc 100644
--- a/ext/gtk+/php_gtk+.c
+++ b/ext/gtk+/php_gtk+.c
@@ -44,6 +44,7 @@ static void init_gtk(TSRMLS_D)
char **argv = NULL;
int argc, i;
zend_bool no_argc = 0;
+ GError *error = NULL;

/*
* Grab the argc/argv values from $_SERVER array.
@@ -90,13 +91,16 @@ static void init_gtk(TSRMLS_D)
unloaded. */
//DL_LOAD("libgtk.so");

- if (!gtk_init_check(&argc, &argv)) {
+ // New error handler that passes the actual gtk_init error
+
+ if (!gtk_init_with_args(&argc, &argv, NULL, NULL, NULL, &error)) {
if (argv != NULL) {
for (i = 0; i < argc; i++)
g_free(argv[i]);
g_free(argv);
}
- php_error(E_ERROR, "php-gtk: Could not open display");
+ php_error(E_ERROR, "%s", error->message);
+ g_error_free (error);
return;
}
--
PHP-GTK CVS Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...