[gjs/master.windows: 6/9] gi/[arg|object].cpp: Avoid ambiguity in smart pointers



commit a7f8d2b19d28afa2bbd0c1e29746a1a231aa6378
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Feb 22 15:32:23 2019 +0800

    gi/[arg|object].cpp: Avoid ambiguity in smart pointers
    
    Use the .get() accessor to concretely get the underlying GI types.

 gi/arg.cpp    | 2 +-
 gi/object.cpp | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 8ab18290..21415bfa 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -1592,7 +1592,7 @@ gjs_value_to_g_argument(JSContext      *context,
 
             GjsAutoBaseInfo interface_info =
                 g_type_info_get_interface(type_info);
-            g_assert(interface_info != NULL);
+            g_assert(interface_info.get() != NULL);
 
             GIInfoType interface_type = g_base_info_get_type(interface_info);
             if (interface_type == GI_INFO_TYPE_ENUM ||
diff --git a/gi/object.cpp b/gi/object.cpp
index ce431f74..73879343 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -658,7 +658,7 @@ bool ObjectPrototype::resolve_no_info(JSContext* cx, JS::HandleObject obj,
 
         GjsAutoFunctionInfo method_info =
             g_interface_info_find_method(iface_info, name);
-        if (method_info != NULL) {
+        if (method_info.get() != NULL) {
             if (g_function_info_get_flags (method_info) & GI_FUNCTION_IS_METHOD) {
                 if (!gjs_define_function(cx, obj, m_gtype, method_info)) {
                     g_free(interfaces);
@@ -760,7 +760,7 @@ bool ObjectPrototype::resolve_impl(JSContext* context, JS::HandleObject obj,
         bool defined_by_parent;
         GjsAutoVFuncInfo vfunc = find_vfunc_on_parents(
             m_info, name_without_vfunc_, &defined_by_parent);
-        if (vfunc != NULL) {
+        if (vfunc.get() != NULL) {
 
             /* In the event that the vfunc is unchanged, let regular
              * prototypal inheritance take over. */
@@ -2195,7 +2195,7 @@ bool ObjectPrototype::hook_up_vfunc_impl(JSContext* cx,
                          &field_info))
         return false;
 
-    if (field_info != NULL) {
+    if (field_info.get() != NULL) {
         gint offset;
         gpointer method_ptr;
         GjsCallbackTrampoline *trampoline;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]