[gnome-builder] libide/tweaks: cleanup children when cloning



commit 43285dc514f16683b8c8aa33c81d3a0ea0d2b562
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 15 17:42:53 2022 -0700

    libide/tweaks: cleanup children when cloning
    
    We don't want them to skip the root-clone (which is where we want to
    jump back to the alternate object graph).

 src/libide/tweaks/ide-tweaks-item.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/libide/tweaks/ide-tweaks-item.c b/src/libide/tweaks/ide-tweaks-item.c
index 5cc40da96..fa629b32a 100644
--- a/src/libide/tweaks/ide-tweaks-item.c
+++ b/src/libide/tweaks/ide-tweaks-item.c
@@ -131,8 +131,15 @@ ide_tweaks_item_real_copy (IdeTweaksItem *self)
        child = ide_tweaks_item_get_next_sibling (child))
     {
       g_autoptr(IdeTweaksItem) new_child = ide_tweaks_item_copy (child);
+      IdeTweaksItemPrivate *new_child_priv = ide_tweaks_item_get_instance_private (new_child);
 
       ide_tweaks_item_insert_after (new_child, IDE_TWEAKS_ITEM (copy), NULL);
+
+      /* Clear the "original" parent from the child because we want it to
+       * resolve parents through this clone (and then to the alternate
+       * ancestors.
+       */
+      g_clear_weak_pointer (&new_child_priv->parent_before_copy_wr);
     }
 
   g_assert (ide_tweaks_item_get_parent (self) == ide_tweaks_item_get_parent (IDE_TWEAKS_ITEM (copy)));


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