[glib/osx-psn] gapplication: skip unexpected -psn_ parameter
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/osx-psn] gapplication: skip unexpected -psn_ parameter
- Date: Thu, 23 May 2019 07:26:32 +0000 (UTC)
commit e367a4f66f71edaeac157697e7b570f4ae3b8356
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Wed May 22 09:11:26 2019 +0200
gapplication: skip unexpected -psn_ parameter
When an application is launched using Launch Services
osx will add an extra parameter which we were not
handling and then gapplication would abort. Instead we make
an initial parsing and like this we avoid the abort if this
parameter is provided
Fixes https://gitlab.gnome.org/GNOME/glib/issues/1784
gio/gapplication.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 2d2ab48e3..b154cbe6a 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -2458,6 +2458,28 @@ g_application_run (GApplication *application,
sizeof (arguments[0]) * (argc + 1));
}
}
+#elif defined(__APPLE__)
+ {
+ gint i, j;
+
+ /*
+ * OSX adds an unexpected parameter on the format -psn_X_XXXXXX
+ * when opening the application using Launch Services. In order
+ * to avoid that GOption fails to parse this parameter we just
+ * skip it if it was provided.
+ * See: https://gitlab.gnome.org/GNOME/glib/issues/1784
+ */
+ arguments = g_new (gchar *, argc + 1);
+ for (i = 0, j = 0; i < argc; i++)
+ {
+ if (!g_str_has_prefix (argv[i], "-psn_"))
+ {
+ arguments[j] = g_strdup (argv[i]);
+ j++;
+ }
+ }
+ arguments[j] = NULL;
+ }
#else
{
gint i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]