[gjs/gnome-40: 10/30] object: Also unset the object qdata during wrapper destruction




commit 640136d31e3b6f2cd65a9fad28aaa7b8cdc8dc69
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.
    
    (cherry-picked from commit c746a668)

 gi/object.cpp | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 356137ec..7c8cc732 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1754,6 +1754,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]