Skip to content

Commit

Permalink
flutter: Don't hold _hostCpp in a member
Browse files Browse the repository at this point in the history
It can change
  • Loading branch information
iamsergio committed Jan 17, 2025
1 parent c073a6e commit 0d37e27
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/flutter/dart/lib/models/Group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ class Group extends GeometryItem implements ffi.Finalizable, ItemWithTitleBar {
List<DockItem> items = [];
late final TitleBar titlebar;

final ffi.Pointer<void> _hostCpp;
late final ffi.Pointer<void> 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<
Expand All @@ -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<Group>(this);
Expand Down

0 comments on commit 0d37e27

Please sign in to comment.