From 0d37e27ef3b34fa0074c1d58bf4443aec94ab539 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Fri, 17 Jan 2025 19:21:03 +0000 Subject: [PATCH] flutter: Don't hold _hostCpp in a member It can change --- src/flutter/dart/lib/models/Group.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/flutter/dart/lib/models/Group.dart b/src/flutter/dart/lib/models/Group.dart index 41614db5a..960f16bb5 100644 --- a/src/flutter/dart/lib/models/Group.dart +++ b/src/flutter/dart/lib/models/Group.dart @@ -43,13 +43,12 @@ class Group extends GeometryItem implements ffi.Finalizable, ItemWithTitleBar { List items = []; late final TitleBar titlebar; - final ffi.Pointer _hostCpp; late final ffi.Pointer guestCpp; final titleChanged = Signal0(); DropArea dropArea; - Group(this.dropArea, {super.geometry}) : _hostCpp = dropArea.hostPtr { + Group(this.dropArea, {super.geometry}) { titlebar = TitleBar(this); final callbackPointer = ffi.Pointer.fromFunction< @@ -58,7 +57,7 @@ class Group extends GeometryItem implements ffi.Finalizable, ItemWithTitleBar { groupInCtor = this; guestCpp = Bindings.instance.nativeLibrary - .create_guest(this._hostCpp.cast(), callbackPointer); + .create_guest(dropArea.hostPtr.cast(), callbackPointer); groupInCtor = null; _instances[guestCpp.address] = WeakReference(this);