[gjs: 6/22] object: Also unset the object qdata during wrapper destruction




commit c746a6685f9b11f624c31bbac6e7bb422895e16e
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Mar 24 07:31:39 2021 +0100

    object: Also unset the object qdata during wrapper destruction
    
    This codepath is hardly hit, but at this point we're sure that the
    private-gjs we set as qdata is not valid anymore so it's safe to delete
    it.
    
    We've to do it only if the object has not been finalized though, not to
    crash and not to break the assumptions for "disposed" gobject wrappers.

 gi/object.cpp | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index a7757770..cdb85916 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1746,6 +1746,10 @@ ObjectInstance::~ObjectInstance() {
 
         if (!m_gobj_disposed)
             g_object_weak_unref(m_ptr, wrapped_gobj_dispose_notify, this);
+
+        if (!m_gobj_finalized)
+            unset_object_qdata();
+
         release_native_object();
     }
 


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