ucam-department-of-psychiatry / camcops

Cambridge Cognitive and Psychiatric Test Kit (CamCOPS)
Other
12 stars 8 forks source link

Crash when using camera on Android / Qt 6.5 #315

Closed martinburchell closed 6 months ago

martinburchell commented 11 months ago

For example, start the photo task for a patient and click on the camera icon:

F libc    : Fatal signal 11 (SIGSEGV), code 0 (SI_USER from pid 4648, uid 10330) in tid 4685 (qtMainLoopThrea), pid 4439 (camcops.camcops

1  QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::get() const                                                                                                    qscopedpointer.h            111  0x7225cef548 
2  decltype(fp.get()) qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>> const>(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>> const&) qtclasshelpermacros.h       79   0x7225da92a8 
3  QWindow::d_func() const                                                                                                                                                         qwindow.h                   65   0x7225e70d10 
4  QWindow::isVisible() const                                                                                                                                                      qwindow.cpp                 656  0x7225e7311c 
5  QAndroidPlatformScreen::doRedraw(QImage *)                                                                                                                                      qandroidplatformscreen.cpp  437  0x72034fd450 
6  QAndroidPlatformScreen::event(QEvent *)                                                                                                                                         qandroidplatformscreen.cpp  166  0x72034fcfb0 
7  QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                         qapplication.cpp            3287 0x721f880380 
8  QApplication::notify(QObject *, QEvent *)                                                                                                                                       qapplication.cpp            3238 0x721f883e70 
9  QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                          qcoreapplication.cpp        1118 0x7229dd5f70 
10 QCoreApplication::sendEvent(QObject *, QEvent *)                                                                                                                                qcoreapplication.cpp        1536 0x7229dd6f98 
11 QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *)                                                                                                        qcoreapplication.cpp        1898 0x7229dd804c 
12 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                      qeventdispatcher_unix.cpp   432  0x722a0bb074 
13 QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                   qunixeventdispatcher.cpp    27   0x72264add78 
14 QAndroidEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                   qandroideventdispatcher.cpp 63   0x72034b511c 
15 QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                          qcoreapplication.cpp        1347 0x7229dd67cc 
16 SlowGuiGuard::SlowGuiGuard(QApplication&, QWidget *, QString const&, QString const&, int)                                                                                       slowguiguard.cpp            62   0x72024419f4 
17 CamcopsApp::getSlowGuiGuard(QString const&, QString const&, int)                                                                                                                camcopsapp.cpp              1847 0x72022df6c4 
18 CamcopsApp::openSubWindow(OpenableWidget *, QSharedPointer<Task>, bool, QSharedPointer<Patient>)                                                                                camcopsapp.cpp              1899 0x72022df33c 
19 Questionnaire::openSubWidget(OpenableWidget *)                                                                                                                                  questionnaire.cpp           712  0x72028048b8 
20 QuPhoto::takePhoto()                                                                                                                                                            quphoto.cpp                 257  0x720285532c 

Different behaviour observed in a reduced test case when linking with pre-built Qt6.5 with ffmpeg (no crash but camera doesn't work):

W QtCamera2: Failed to start preview:android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): checkPidStatus:2183: The camera device has been disconnected

martinburchell commented 7 months ago

Fixed on the qt6.5 branch by using FFmpeg, the C++ rather then QML camera code and applying the 6.5 patch https://bugreports.qt.io/browse/QTBUG-116526