Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
98643b5f
Unverified
Commit
98643b5f
authored
Feb 13, 2019
by
Gus Grubba
Committed by
GitHub
Feb 13, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7227 from mavlink/crashOnCameraDisconnect
Fix crash bug that could occur when reconnecting a camera.
parents
660a791d
1683185c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
QGCCameraManager.cc
src/Camera/QGCCameraManager.cc
+17
-13
QGCCameraManager.h
src/Camera/QGCCameraManager.h
+1
-1
No files found.
src/Camera/QGCCameraManager.cc
View file @
98643b5f
...
...
@@ -12,8 +12,9 @@
QGC_LOGGING_CATEGORY
(
CameraManagerLog
,
"CameraManagerLog"
)
//-----------------------------------------------------------------------------
QGCCameraManager
::
CameraStruct
::
CameraStruct
(
QObject
*
parent
)
QGCCameraManager
::
CameraStruct
::
CameraStruct
(
QObject
*
parent
,
uint8_t
compID_
)
:
QObject
(
parent
)
,
compID
(
compID_
)
{
}
...
...
@@ -112,7 +113,7 @@ QGCCameraManager::_handleHeartbeat(const mavlink_message_t &message)
QString
sCompID
=
QString
::
number
(
message
.
compid
);
if
(
!
_cameraInfoRequest
.
contains
(
sCompID
))
{
qCDebug
(
CameraManagerLog
)
<<
"Hearbeat from "
<<
message
.
compid
;
CameraStruct
*
pInfo
=
new
CameraStruct
(
this
);
CameraStruct
*
pInfo
=
new
CameraStruct
(
this
,
message
.
compid
);
pInfo
->
lastHeartbeat
.
start
();
_cameraInfoRequest
[
sCompID
]
=
pInfo
;
//-- Request camera info
...
...
@@ -226,19 +227,22 @@ QGCCameraManager::_cameraTimeout()
//-- Has the camera stopped talking to us?
if
(
pInfo
->
lastHeartbeat
.
elapsed
()
>
5000
)
{
//-- Camera is gone. Remove it.
bool
autoStream
=
false
;
QGCCameraControl
*
pCamera
=
_findCamera
(
pInfo
->
compID
);
qWarning
()
<<
"Camera"
<<
pCamera
->
modelName
()
<<
"stopped transmitting. Removing from list."
;
int
idx
=
_cameraLabels
.
indexOf
(
pCamera
->
modelName
());
if
(
idx
>=
0
)
{
_cameraLabels
.
removeAt
(
idx
);
}
idx
=
_cameras
.
indexOf
(
pCamera
);
if
(
idx
>=
0
)
{
_cameras
.
removeAt
(
idx
);
if
(
pCamera
)
{
qWarning
()
<<
"Camera"
<<
pCamera
->
modelName
()
<<
"stopped transmitting. Removing from list."
;
int
idx
=
_cameraLabels
.
indexOf
(
pCamera
->
modelName
());
if
(
idx
>=
0
)
{
_cameraLabels
.
removeAt
(
idx
);
}
idx
=
_cameras
.
indexOf
(
pCamera
);
if
(
idx
>=
0
)
{
_cameras
.
removeAt
(
idx
);
}
autoStream
=
pCamera
->
autoStream
();
pCamera
->
deleteLater
();
delete
pInfo
;
}
bool
autoStream
=
pCamera
->
autoStream
();
pCamera
->
deleteLater
();
delete
pInfo
;
_cameraInfoRequest
.
remove
(
sCompID
);
emit
cameraLabelsChanged
();
//-- If we have another camera, switch current camera.
...
...
src/Camera/QGCCameraManager.h
View file @
98643b5f
...
...
@@ -76,7 +76,7 @@ protected:
class
CameraStruct
:
public
QObject
{
public:
CameraStruct
(
QObject
*
parent
);
CameraStruct
(
QObject
*
parent
,
uint8_t
compID_
);
QTime
lastHeartbeat
;
bool
infoReceived
=
false
;
bool
gaveUp
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment