Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@kmorkos
Copy link
Contributor

@kmorkos kmorkos commented Jun 29, 2018

Fix crash referenced in flutter/flutter#18348

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@kmorkos
Copy link
Contributor Author

kmorkos commented Jul 4, 2018

I signed it

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Jul 4, 2018
@maral
Copy link

maral commented Jul 13, 2018

@kmorkos I have just checked your fix by changing pubspec.yaml as you mentioned in flutter/flutter#18348, and it fixed the first error, however introduced another one. I wonder if it has something to do with the CameraPreview I am using. There is no way to dispose that 😢.

This happens after I leave the camera page and go back to previous page. Immediately the error occurs.

Should I file a new issue?

This is the stacktrace:

I/RequestThread-0(17244): Received jpeg.
I/RequestThread-0(17244): Producing jpeg buffer...
I/flutter (17244): Picture saved to /data/user/0/cz.codit.stromysvobody/app_flutter/Pictures/strom_71.jpg
W/LegacyRequestMapper(17244): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
W/LegacyRequestMapper(17244): Only received metering rectangles with weight 0.
W/LegacyRequestMapper(17244): Only received metering rectangles with weight 0.
I/zygote64(17244): Do full code cache collection, code=249KB, data=171KB
I/zygote64(17244): After code cache collection, code=239KB, data=144KB
I/SimplePermission(17244): Requesting permission : android.permission.ACCESS_FINE_LOCATION
I/RequestQueue(17244): Repeating capture request cancelled.
E/BufferQueueProducer(17244): [SurfaceTexture-1-17244-2] cancelBuffer: BufferQueue has been abandoned
I/chatty  (17244): uid=10167(u0_a167) Binder:17244_2 identical 1 line
E/BufferQueueProducer(17244): [SurfaceTexture-1-17244-2] cancelBuffer: BufferQueue has been abandoned
I/SimplePermission(17244): Requesting permission result : true
E/libc    (17244): Access denied finding property "persist.camera.cfa.packagelist"
I/CameraManager(17244): Using legacy camera HAL.
E/libc    (17244): Access denied finding property "camera.hal1.packagelist"
I/flutter (17244): ##### DISPOSING CAMERA PAGE (my own message)
E/GLConsumer(17244): [SurfaceTexture-0-17244-0] setDefaultBufferSize: GLConsumer is abandoned!
D/AndroidRuntime(17244): Shutting down VM
E/AndroidRuntime(17244): FATAL EXCEPTION: main
E/AndroidRuntime(17244): Process: cz.codit.stromysvobody, PID: 17244
E/AndroidRuntime(17244): java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Surface android.media.ImageReader.getSurface()' on a null object reference
E/AndroidRuntime(17244): 	at io.flutter.plugins.camera.CameraPlugin$Camera.startPreview(CameraPlugin.java:676)
E/AndroidRuntime(17244): 	at io.flutter.plugins.camera.CameraPlugin$Camera.access$2000(CameraPlugin.java:243)
E/AndroidRuntime(17244): 	at io.flutter.plugins.camera.CameraPlugin$Camera$3.onOpened(CameraPlugin.java:443)
E/AndroidRuntime(17244): 	at android.hardware.camera2.impl.CameraDeviceImpl$1.run(CameraDeviceImpl.java:143)
E/AndroidRuntime(17244): 	at android.os.Handler.handleCallback(Handler.java:789)
E/AndroidRuntime(17244): 	at android.os.Handler.dispatchMessage(Handler.java:98)
E/AndroidRuntime(17244): 	at android.os.Looper.loop(Looper.java:172)
E/AndroidRuntime(17244): 	at android.app.ActivityThread.main(ActivityThread.java:6637)
E/AndroidRuntime(17244): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(17244): 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
E/AndroidRuntime(17244): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

@maral
Copy link

maral commented Jul 13, 2018

Interesting, it works now and no error. Who knows why, this is all magic to me.
EDIT: It happened again, but it happens not too often, randomly.

@mvwaran
Copy link

mvwaran commented Sep 11, 2018

When it will be fixed? I'm still facing the issue and i'm using camera plugin 0.2.3 version.

@kmorkos
Copy link
Contributor Author

kmorkos commented Sep 12, 2018

It was never merged in... I'm not sure how to get a reviewer to look at it.

@kmorkos
Copy link
Contributor Author

kmorkos commented Sep 12, 2018

@kroikie I saw you were assigned to some other pull requests. Perhaps you can take a look at this or tag somebody else who can?

@bparrishMines bparrishMines self-assigned this Sep 27, 2018
@bparrishMines bparrishMines self-requested a review September 27, 2018 20:09
@bparrishMines
Copy link
Contributor

Hi @kmorkos

Everything looks good except I think you should re-register the activitylifecyclecallbacks in the 'initialize' method. I think an error would occur if one camera was disposed and then another was initialized without the activitylifecyclecallback being registered.

@kmorkos
Copy link
Contributor Author

kmorkos commented Sep 27, 2018

@bparrishMines thanks for checking this out. That makes sense, just made that change!

@bparrishMines bparrishMines merged commit 031310a into flutter:master Sep 28, 2018
@bparrishMines
Copy link
Contributor

Merged! I created a PR to bump the version on pub.
@maral Are you still having crashes from this PR? Based on the camera plugin code, I think it may be caused by a separate bug.

@kmorkos
Copy link
Contributor Author

kmorkos commented Oct 1, 2018

@bparrishMines thanks! Can you push the update to pub please? 😄

@bparrishMines
Copy link
Contributor

@kmorkos Sorry about that! Published!

andreidiaconu added a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
Akachu pushed a commit to Akachu/flutter_camera that referenced this pull request Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants