diff --git a/packages/tizen_bundle/CHANGELOG.md b/packages/tizen_bundle/CHANGELOG.md index 32f679856..9efd7e3cb 100644 --- a/packages/tizen_bundle/CHANGELOG.md +++ b/packages/tizen_bundle/CHANGELOG.md @@ -1,6 +1,7 @@ ## NEXT * Increase the minimum Flutter version to 3.3. +* Fix token in finalizer to be different from value. ## 0.1.1 diff --git a/packages/tizen_bundle/lib/tizen_bundle.dart b/packages/tizen_bundle/lib/tizen_bundle.dart index 72c457539..c2358bafe 100644 --- a/packages/tizen_bundle/lib/tizen_bundle.dart +++ b/packages/tizen_bundle/lib/tizen_bundle.dart @@ -20,20 +20,20 @@ class Bundle extends MapMixin { /// Creates an empty [Bundle]. Bundle() { _handle = tizen.bundle_create(); - _finalizer.attach(this, this, detach: this); + _finalizer.attach(this, _handle, detach: this); } /// Creates a [Bundle] from the encoded bundle string. Bundle.decode(String raw) { _handle = tizen.bundle_decode( raw.toNativeInt8().cast(), raw.length); - _finalizer.attach(this, this, detach: this); + _finalizer.attach(this, _handle, detach: this); } /// Creates a copy of the given [bundle]. Bundle.fromBundle(Bundle bundle) { _handle = tizen.bundle_dup(bundle._handle); - _finalizer.attach(this, this, detach: this); + _finalizer.attach(this, _handle, detach: this); } /// Creates a [Bundle] from the given [map]. @@ -44,8 +44,9 @@ class Bundle extends MapMixin { } late final Pointer _handle; - static final Finalizer _finalizer = - Finalizer((Bundle bundle) => tizen.bundle_free(bundle._handle)); + static final Finalizer> _finalizer = + Finalizer>( + (Pointer bundle) => tizen.bundle_free(bundle)); static final List _keys = []; diff --git a/packages/tizen_rpc_port/CHANGELOG.md b/packages/tizen_rpc_port/CHANGELOG.md index 5fc23db03..f6d635da9 100644 --- a/packages/tizen_rpc_port/CHANGELOG.md +++ b/packages/tizen_rpc_port/CHANGELOG.md @@ -1,3 +1,7 @@ +## NEXT + +* Fix token in finalizer to be different from value. + ## 0.1.3 * Remove unnecessary `StreamHandlerError` implementation. diff --git a/packages/tizen_rpc_port/lib/src/proxy_base.dart b/packages/tizen_rpc_port/lib/src/proxy_base.dart index 44c7da283..e546e1425 100644 --- a/packages/tizen_rpc_port/lib/src/proxy_base.dart +++ b/packages/tizen_rpc_port/lib/src/proxy_base.dart @@ -38,16 +38,13 @@ abstract class ProxyBase { return pProxy.value; }); - _finalizer.attach(this, this); + _finalizer.attach(this, _handle); } late final rpc_port_proxy_h _handle; - final Finalizer _finalizer = - Finalizer((ProxyBase proxy) { - proxy._streamSubscription?.cancel(); - tizen.rpc_port_proxy_destroy(proxy._handle); - }); + final Finalizer _finalizer = Finalizer( + (rpc_port_proxy_h handle) => tizen.rpc_port_proxy_destroy(handle)); /// The server application ID. final String appid; diff --git a/packages/tizen_rpc_port/lib/src/stub_base.dart b/packages/tizen_rpc_port/lib/src/stub_base.dart index dc2e26237..1227188b1 100644 --- a/packages/tizen_rpc_port/lib/src/stub_base.dart +++ b/packages/tizen_rpc_port/lib/src/stub_base.dart @@ -33,14 +33,13 @@ abstract class StubBase { return pStub.value; }); - _finalizer.attach(this, this); + _finalizer.attach(this, _handle); } late final rpc_port_stub_h _handle; - final Finalizer _finalizer = Finalizer((StubBase stub) { - stub.close(); - }); + final Finalizer _finalizer = Finalizer( + (rpc_port_stub_h handle) => tizen.rpc_port_stub_destroy(handle)); /// A port name to use when listening for connections. final String portName;