fix crash, current rgba ffi design still ugly and dangerous

This commit is contained in:
open-trade
2020-11-18 18:12:43 +08:00
parent 33186e28d1
commit c469329d19
2 changed files with 17 additions and 11 deletions

View File

@@ -80,13 +80,12 @@ class FFI {
setByName('connect', id);
}
static void _clearRgbaFrame() {
static void clearRgbaFrame() {
if (_lastRgbaFrame != null && _lastRgbaFrame != nullptr)
_freeRgba(_lastRgbaFrame);
}
static Uint8List getRgba() {
_clearRgbaFrame();
_lastRgbaFrame = _getRgba();
if (_lastRgbaFrame == null || _lastRgbaFrame == nullptr) return null;
final ref = _lastRgbaFrame.ref;
@@ -115,7 +114,6 @@ class FFI {
}
static void close() {
_clearRgbaFrame();
setByName('close', '');
}