Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
libksane
Commits
08ea3fbc
Commit
08ea3fbc
authored
Jul 04, 2021
by
Alexander Stippich
Browse files
prevent crashes when no device is opened
m_scanThread is only available when a device is opened, guard against nullptr
parent
b3a6ced3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ksanecore.cpp
View file @
08ea3fbc
...
...
@@ -196,6 +196,9 @@ bool KSaneCore::closeDevice()
void
KSaneCore
::
startScan
()
{
if
(
!
d
->
m_saneHandle
)
{
return
;
}
d
->
m_cancelMultiPageScan
=
false
;
// execute a pending value reload
while
(
d
->
m_readValuesTimer
.
isActive
())
{
...
...
@@ -208,6 +211,10 @@ void KSaneCore::startScan()
void
KSaneCore
::
stopScan
()
{
if
(
!
d
->
m_saneHandle
)
{
return
;
}
d
->
m_cancelMultiPageScan
=
true
;
if
(
d
->
m_scanThread
->
isRunning
())
{
d
->
m_scanThread
->
cancelScan
();
...
...
@@ -216,17 +223,24 @@ void KSaneCore::stopScan()
QImage
*
KSaneCore
::
scanImage
()
const
{
return
d
->
m_scanThread
->
scanImage
();
if
(
d
->
m_saneHandle
!=
nullptr
)
{
return
d
->
m_scanThread
->
scanImage
();
}
return
nullptr
;
}
void
KSaneCore
::
lockScanImage
()
{
d
->
m_scanThread
->
lockScanImage
();
if
(
d
->
m_saneHandle
!=
nullptr
)
{
d
->
m_scanThread
->
lockScanImage
();
}
}
void
KSaneCore
::
unlockScanImage
()
{
d
->
m_scanThread
->
unlockScanImage
();
if
(
d
->
m_saneHandle
!=
nullptr
)
{
d
->
m_scanThread
->
unlockScanImage
();
}
}
QList
<
KSaneOption
*>
KSaneCore
::
getOptionsList
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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