[gjs/gbsneto/fundamental-fixes] fundamental: Check if gtype is valid before using it
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gbsneto/fundamental-fixes] fundamental: Check if gtype is valid before using it
- Date: Tue, 9 Oct 2018 22:54:18 +0000 (UTC)
commit 0ce728079290c0a763cd1bf6a32e7ea5ba5862ba
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Oct 9 19:52:39 2018 -0300
fundamental: Check if gtype is valid before using it
Not a big deal, but found this bug while investigating some
problems that arose from https://gitlab.gnome.org/GNOME/mutter/merge_requests/260.
We should check if the GType is valid before using it, not
after.
gi/fundamental.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index a5e1ce95..04332f78 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -629,10 +629,10 @@ gjs_lookup_fundamental_prototype_from_gtype(JSContext *context,
/* A given gtype might not have any definition in the introspection
* data. If that's the case, try to look for a definition of any of the
* parent type. */
- while ((info = (GIObjectInfo *)
+ while (gtype != G_TYPE_INVALID &&
+ (info = (GIObjectInfo *)
g_irepository_find_by_gtype(g_irepository_get_default(),
- gtype)) == NULL &&
- gtype != G_TYPE_INVALID)
+ gtype)) == NULL)
gtype = g_type_parent(gtype);
proto = gjs_lookup_fundamental_prototype(context, info, gtype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]