diff --git a/Android/MMKV/mmkvdemo/build.gradle b/Android/MMKV/mmkvdemo/build.gradle index a22713da..5b6d4e10 100644 --- a/Android/MMKV/mmkvdemo/build.gradle +++ b/Android/MMKV/mmkvdemo/build.gradle @@ -102,10 +102,10 @@ def mmkvVersion = "${VERSION_NAME_PREFIX}${VERSION_NAME_SUFFIX}" dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation project(':mmkv') +// implementation project(':mmkv') // implementation "com.tencent:mmkv:$mmkvVersion" // implementation "com.tencent:mmkv-static:$mmkvVersion" // this is identical to 'com.tencent:mmkv' -// implementation "com.tencent:mmkv-shared:$mmkvVersion" // with prefab functionality + implementation "com.tencent:mmkv-shared:$mmkvVersion" // with prefab functionality implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.constraintlayout:constraintlayout:2.2.1' testImplementation 'junit:junit:4.13.2' diff --git a/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldb_helper.py b/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldb_helper.py new file mode 100644 index 00000000..a88caf99 --- /dev/null +++ b/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldb_helper.py @@ -0,0 +1,32 @@ +# +# Generated file, do not edit. +# + +import lldb + +def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict): + """Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages.""" + base = frame.register["x0"].GetValueAsAddress() + page_len = frame.register["x1"].GetValueAsUnsigned() + + # Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the + # first page to see if handled it correctly. This makes diagnosing + # misconfiguration (e.g. missing breakpoint) easier. + data = bytearray(page_len) + data[0:8] = b'IHELPED!' + + error = lldb.SBError() + frame.GetThread().GetProcess().WriteMemory(base, data, error) + if not error.Success(): + print(f'Failed to write into {base}[+{page_len}]', error) + return + +def __lldb_init_module(debugger: lldb.SBDebugger, _): + target = debugger.GetDummyTarget() + # Caveat: must use BreakpointCreateByRegEx here and not + # BreakpointCreateByName. For some reasons callback function does not + # get carried over from dummy target for the later. + bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$") + bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__)) + bp.SetAutoContinue(True) + print("-- LLDB integration loaded --") diff --git a/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldbinit b/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldbinit new file mode 100644 index 00000000..e3ba6fbe --- /dev/null +++ b/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldbinit @@ -0,0 +1,5 @@ +# +# Generated file, do not edit. +# + +command script import --relative-to-command-file flutter_lldb_helper.py diff --git a/flutter/mmkv/pubspec.yaml b/flutter/mmkv/pubspec.yaml index ab770d5a..95a60757 100644 --- a/flutter/mmkv/pubspec.yaml +++ b/flutter/mmkv/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: ffi: ^2.0.0 mmkv_ios: '>=2.2.3 <2.3.0' - # path: ../mmkv_ios +# path: ../mmkv_ios mmkv_android: '>=2.2.3 <2.3.0' # path: ../mmkv_android @@ -28,7 +28,7 @@ dependencies: '>=2.2.3 <2.3.0' # path: ../mmkv_linux mmkv_platform_interface: - '>=2.2.2 <2.3.0' + '>=2.2.3 <2.3.0' # path: ../mmkv_platform_interface dev_dependencies: diff --git a/flutter/mmkv_android/pubspec.yaml b/flutter/mmkv_android/pubspec.yaml index 765b79e7..a313f7b6 100644 --- a/flutter/mmkv_android/pubspec.yaml +++ b/flutter/mmkv_android/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: sdk: flutter ffi: ^2.0.0 mmkv_platform_interface: - '>=2.2.2 <2.3.0' + '>=2.2.3 <2.3.0' # path: ../mmkv_platform_interface dev_dependencies: diff --git a/flutter/mmkv_ios/pubspec.yaml b/flutter/mmkv_ios/pubspec.yaml index 40332c6e..c9293429 100644 --- a/flutter/mmkv_ios/pubspec.yaml +++ b/flutter/mmkv_ios/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: sdk: flutter ffi: ^2.0.0 mmkv_platform_interface: - '>=2.2.2 <2.3.0' + '>=2.2.3 <2.3.0' # path: ../mmkv_platform_interface dev_dependencies: diff --git a/flutter/mmkv_linux/pubspec.yaml b/flutter/mmkv_linux/pubspec.yaml index f631b112..5d0ac971 100644 --- a/flutter/mmkv_linux/pubspec.yaml +++ b/flutter/mmkv_linux/pubspec.yaml @@ -5,15 +5,15 @@ version: 2.2.3 homepage: https://github.com/Tencent/mmkv environment: - sdk: ^3.9.0 - flutter: '>=3.3.0' + sdk: '>=2.17.0 <4.0.0' + flutter: ">=3.0.0" dependencies: flutter: sdk: flutter ffi: ^2.0.0 mmkv_platform_interface: - '>=2.2.2 <2.3.0' + '>=2.2.3 <2.3.0' # path: ../mmkv_platform_interface dev_dependencies: diff --git a/flutter/mmkv_ohos/pubspec.yaml b/flutter/mmkv_ohos/pubspec.yaml index 9584a6c9..b50842bf 100644 --- a/flutter/mmkv_ohos/pubspec.yaml +++ b/flutter/mmkv_ohos/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # path: "packages/path_provider/path_provider_ohos" ffi: ^2.0.0 mmkv_platform_interface: - '>=2.2.2 <2.3.0' + '>=2.2.3 <2.3.0' # path: ../mmkv_platform_interface dev_dependencies: diff --git a/flutter/mmkv_platform_interface/CHANGELOG.md b/flutter/mmkv_platform_interface/CHANGELOG.md index aab1fe7b..c85a767f 100644 --- a/flutter/mmkv_platform_interface/CHANGELOG.md +++ b/flutter/mmkv_platform_interface/CHANGELOG.md @@ -1,4 +1,7 @@ # MMKV Platform Interface Change Log +## v2.2.3 / 2025-08-20 +* Protect from `freePtr()` not found. + ## v2.2.2 / 2025-08-20 * Add `freePtr()`, mainly for Windows. diff --git a/flutter/mmkv_platform_interface/lib/mmkv_platform_ffi.dart b/flutter/mmkv_platform_interface/lib/mmkv_platform_ffi.dart index 76e4fe32..95e6c629 100644 --- a/flutter/mmkv_platform_interface/lib/mmkv_platform_ffi.dart +++ b/flutter/mmkv_platform_interface/lib/mmkv_platform_ffi.dart @@ -354,7 +354,10 @@ class MMKVPluginPlatformFFI extends MMKVPluginPlatform { @override void Function(Pointer) freePtrFunc() { - final ptr = nativeLib().lookup>(nativeFuncName("freePtr")); - return ptr != nullptr ? ptr.asFunction() : calloc.free; + try { + return nativeLib().lookup>(nativeFuncName("freePtr")).asFunction(); + } catch (e) { + return calloc.free; + } } } diff --git a/flutter/mmkv_platform_interface/pubspec.yaml b/flutter/mmkv_platform_interface/pubspec.yaml index c40fb0d1..504752fe 100644 --- a/flutter/mmkv_platform_interface/pubspec.yaml +++ b/flutter/mmkv_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the MMKV plugin. repository: https://github.com/Tencent/MMKV/tree/master/flutter/mmkv_platform_interface # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.2.2 +version: 2.2.3 homepage: https://github.com/Tencent/MMKV environment: diff --git a/flutter/mmkv_win32/pubspec.yaml b/flutter/mmkv_win32/pubspec.yaml index ee5f155f..48fa62d8 100644 --- a/flutter/mmkv_win32/pubspec.yaml +++ b/flutter/mmkv_win32/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: sdk: flutter ffi: ^2.0.0 mmkv_platform_interface: - '>=2.2.2 <2.3.0' + '>=2.2.3 <2.3.0' # path: ../mmkv_platform_interface dev_dependencies: