[gimp] libgimp: don't use G_IS_FILE() and g_file_get_path() on a NULL GFile
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: don't use G_IS_FILE() and g_file_get_path() on a NULL GFile
- Date: Mon, 12 Aug 2019 17:12:32 +0000 (UTC)
commit 42e8a344ab486b2e71ca22401dc0023600c46497
Author: Michael Natterer <mitch gimp org>
Date: Mon Aug 12 19:09:08 2019 +0200
libgimp: don't use G_IS_FILE() and g_file_get_path() on a NULL GFile
when registering the plug-in's translation domain. A NULL path is
allowed and used by script-fu.
libgimp/gimpplugin-private.c | 5 ++++-
libgimp/gimpplugin.c | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/libgimp/gimpplugin-private.c b/libgimp/gimpplugin-private.c
index d6b3d2d55b..3366831bf5 100644
--- a/libgimp/gimpplugin-private.c
+++ b/libgimp/gimpplugin-private.c
@@ -199,7 +199,10 @@ gimp_plug_in_register (GimpPlugIn *plug_in,
if (plug_in->priv->translation_domain_name)
{
- gchar *path = g_file_get_path (plug_in->priv->translation_domain_path);
+ gchar *path = NULL;
+
+ if (plug_in->priv->translation_domain_path)
+ path = g_file_get_path (plug_in->priv->translation_domain_path);
_gimp_plugin_domain_register (plug_in->priv->translation_domain_name,
path);
diff --git a/libgimp/gimpplugin.c b/libgimp/gimpplugin.c
index 5f0e4d84f2..c02be8ebc1 100644
--- a/libgimp/gimpplugin.c
+++ b/libgimp/gimpplugin.c
@@ -226,7 +226,7 @@ gimp_plug_in_get_property (GObject *object,
* gimp_plug_in_set_translation_domain:
* @plug_in: A #GimpPlugIn.
* @domain_name: The name of the textdomain (must be unique).
- * @domain_path: The absolute path to the compiled message catalog
+ * @domain_path: (nullable): A #GFile pointing to the compiled message catalog
* (may be %NULL).
*
* Sets a textdomain for localisation for the @plug_in.
@@ -250,7 +250,7 @@ gimp_plug_in_set_translation_domain (GimpPlugIn *plug_in,
{
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
g_return_if_fail (domain_name != NULL);
- g_return_if_fail (G_IS_FILE (domain_path));
+ g_return_if_fail (domain_path == NULL || G_IS_FILE (domain_path));
g_free (plug_in->priv->translation_domain_name);
plug_in->priv->translation_domain_name = g_strdup (domain_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]