[glib: 1/3] Add vfunc checks in gappinfo.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/3] Add vfunc checks in gappinfo.c
- Date: Wed, 24 Nov 2021 15:02:53 +0000 (UTC)
commit ebddb60e3e05261db34aa13e443ab870b0dade1d
Author: Luca Bacci <luca bacci982 gmail com>
Date: Wed Nov 24 14:34:57 2021 +0100
Add vfunc checks in gappinfo.c
Fixes crashes caused by calling unimplemented vfuncs on Windows
gio/gappinfo.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gio/gappinfo.c b/gio/gappinfo.c
index d9d2bdaf7..3f0332825 100644
--- a/gio/gappinfo.c
+++ b/gio/gappinfo.c
@@ -326,7 +326,12 @@ g_app_info_set_as_default_for_type (GAppInfo *appinfo,
iface = G_APP_INFO_GET_IFACE (appinfo);
- return (* iface->set_as_default_for_type) (appinfo, content_type, error);
+ if (iface->set_as_default_for_type)
+ return (* iface->set_as_default_for_type) (appinfo, content_type, error);
+
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("Setting default applications not supported yet"));
+ return FALSE;
}
/**
@@ -354,7 +359,12 @@ g_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
iface = G_APP_INFO_GET_IFACE (appinfo);
- return (* iface->set_as_last_used_for_type) (appinfo, content_type, error);
+ if (iface->set_as_last_used_for_type)
+ return (* iface->set_as_last_used_for_type) (appinfo, content_type, error);
+
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("Setting application as last used for type not supported yet"));
+ return FALSE;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]