howljs / hl_image_picker

Simplify media selection, cropping, and camera functionality in your Flutter app. Choose images/videos from the library, crop images, and capture new photos/videos with ease.
https://pub.dev/packages/hl_image_picker
24 stars 14 forks source link

Window Leaked on Video Selected #41

Open cavedweller opened 2 months ago

cavedweller commented 2 months ago

Hi @howljs,

Thanks for the great package 👌

I am able to select a video that exceeds a predefined video length, by just tapping in the middle of the video thumbnail. It then allows me to view the video and select done which then throws a windows leak in the logs. I am not able to catch this issue for some reason.

However when I select the circle, it then shows that the selected video is to long.

Steps to reproduce:

List<HLPickerItem> media = await _picker.openPicker(            
                      pickerOptions: HLPickerOptions(
                          mediaType: MediaType.video,
                          compressQuality: 0.7,
                          compressFormat: CompressFormat.jpg,
                          maxSizeOutput:
                              MaxSizeOutput(maxWidth: 1080, maxHeight: 1920),
                          isExportThumbnail: true,
                          minDuration: 3,
                          maxDuration: 90
                          usedCameraButton: false,
                          enablePreview: false,
                          maxSelectedAssets:1));
                  if (media.isEmpty) {
                    Navigator.pop(context);
                  } else {
                    selectedData = [];
                    for (HLPickerItem loop in media) {
                      selectedData.add(MediaInfo(
                          path: loop.path,
                          id: loop.id,
                          thumbnail: loop.thumbnail,
                          type: loop.type));
                    }
                    setState(() {});
                  }
                } on PlatformException catch (e) {
                  print('Platform Exception: $e');
                } catch (e) {
                  print('Caught Exception: $e');
                }

Please see the log below:

 Activity com.luck.picture.lib.basic.PictureSelectorSupporterActivity has leaked window DecorView@3803f01[PictureSelectorSupporterActivity] that was originally added here
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1275)
    at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1252)
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:490)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:150)
    at android.app.Dialog.show(Dialog.java:512)
    at com.howl.hl_image_picker.HLImagePickerPlugin.showDialog(HLImagePickerPlugin.kt:383)
    at com.howl.hl_image_picker.HLImagePickerPlugin.handleSelectLimitTips(HLImagePickerPlugin.kt:330)
    at com.howl.hl_image_picker.HLImagePickerPlugin.openPicker$lambda$4(HLImagePickerPlugin.kt:219)
    at com.howl.hl_image_picker.HLImagePickerPlugin.$r8$lambda$xFzl1DEOBEUA30n7-6uj5x8BNIM(Unknown Source:0)
    at com.howl.hl_image_picker.HLImagePickerPlugin$$ExternalSyntheticLambda6.onSelectLimitTips(Unknown Source:2)
    at com.luck.picture.lib.basic.PictureCommonFragment.checkOnlyMimeTypeValidity(PictureCommonFragment.java:671)
    at com.luck.picture.lib.basic.PictureCommonFragment.isCheckSelectValidity(PictureCommonFragment.java:464)
    at com.luck.picture.lib.basic.PictureCommonFragment.confirmSelect(PictureCommonFragment.java:413)
    at com.luck.picture.lib.PictureSelectorPreviewFragment$6.onClick(PictureSelectorPreviewFragment.java:710)
    at android.view.View.performClick(View.java:8043)
    at android.view.View.performClickInternal(View.java:8020)
    at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
    at android.view.View$PerformClick.run(View.java:31850)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:230)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8893)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

https://github.com/user-attachments/assets/0b96eca8-181e-4876-9c7d-7368a8945b14