native icon indicating copy to clipboard operation
native copied to clipboard

JArray.getRange() has thread-safety problem

Open brandon3343 opened this issue 9 months ago • 3 comments

Future<Uint8List> getIcon(String packageName) async {
    final JArray<jbyte> jArray = await getIconFromAndroid(packageName);

    // There is a thread safety issue with the following line of code, 
    return jArray.getRange(0, jArray.length).buffer.asUint8List();
}

multiple executions test(), the return value maybe incorrect.

Isolate.run(() async {
    final icon = getIcon('package1'); // maybe incorret
});
Isolate.run(() async  {
    final icon = getIcon('package2'); // maybe incorret
});

brandon3343 avatar May 16 '24 03:05 brandon3343