[glibmm/glibmm-2-66] Gio::ListModel::get_object(): Don't try to cast to Glib::Object
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-2-66] Gio::ListModel::get_object(): Don't try to cast to Glib::Object
- Date: Thu, 15 Jul 2021 16:49:52 +0000 (UTC)
commit 1c5eb0a92a71f836f273e8cb97662f9c57fa762f
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Thu Jul 15 18:46:58 2021 +0200
Gio::ListModel::get_object(): Don't try to cast to Glib::Object
Gio::ListModel::get_object() returns Glib::RefPtr<Glib::ObjectBase>.
Don't try to dynamic_cast it to Glib::Object. It would fail if the object
has been constructed as an interface, and e.g. has a Gio::File wrapper.
Fixes #93
gio/src/listmodel.hg | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/gio/src/listmodel.hg b/gio/src/listmodel.hg
index 3d1f31fe..d2854282 100644
--- a/gio/src/listmodel.hg
+++ b/gio/src/listmodel.hg
@@ -90,6 +90,10 @@ public:
//It doesn't do anything differently.
_IGNORE(g_list_model_get_item)
+ // Don't use Glib::RefPtr<Glib::Object> Glib::wrap(GObject* object, bool take_copy).
+ // The object may be an interface object, e.g. Gio::File. Such an object can't be
+ // cast to Glib::Object. https://gitlab.gnome.org/GNOME/glibmm/-/issues/93
+#m4
_CONVERSION(`GObject*',`Glib::RefPtr<Glib::ObjectBase>',`Glib::RefPtr<Glib::ObjectBase>(Glib::wrap_auto($3))')
_WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_object(guint position), g_list_model_get_object, newin
"2,50")
_WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_object(guint position) const,
g_list_model_get_object, constversion, newin "2,50")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]