Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
1920dd4c
Commit
1920dd4c
authored
May 31, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix possible crash when load task is running on exit
parent
16b177c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/jobs/cliploadtask.cpp
View file @
1920dd4c
...
...
@@ -735,11 +735,13 @@ void ClipLoadTask::run()
void
ClipLoadTask
::
abort
()
{
Fun
undo
=
[]()
{
return
true
;
};
Fun
redo
=
[]()
{
return
true
;
};
m_progress
=
100
;
pCore
->
taskManager
.
taskDone
(
m_owner
.
second
,
this
);
qDebug
()
<<
pCore
->
projectItemModel
()
->
getClipByBinID
(
QString
::
number
(
m_owner
.
second
))
->
clipUrl
();
if
(
pCore
->
taskManager
.
isBlocked
())
{
return
;
}
Fun
undo
=
[]()
{
return
true
;
};
Fun
redo
=
[]()
{
return
true
;
};
QString
resource
=
Xml
::
getXmlProperty
(
m_xml
,
QStringLiteral
(
"resource"
));
if
(
!
m_softDelete
)
{
auto
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
QString
::
number
(
m_owner
.
second
));
...
...
src/jobs/taskmanager.cpp
View file @
1920dd4c
...
...
@@ -22,6 +22,7 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
TaskManager
::
TaskManager
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_tasksListLock
(
QReadWriteLock
::
Recursive
)
,
m_blockUpdates
(
false
)
{
int
maxThreads
=
qMin
(
4
,
QThread
::
idealThreadCount
()
-
1
);
m_taskPool
.
setMaxThreadCount
(
qMax
(
maxThreads
,
1
));
...
...
@@ -33,6 +34,11 @@ TaskManager::~TaskManager()
slotCancelJobs
();
}
bool
TaskManager
::
isBlocked
()
const
{
return
m_blockUpdates
;
}
void
TaskManager
::
updateConcurrency
()
{
m_transcodePool
.
setMaxThreadCount
(
KdenliveSettings
::
proxythreads
());
...
...
@@ -124,6 +130,7 @@ void TaskManager::slotCancelJobs()
{
m_tasksListLock
.
lockForRead
();
// See if there is already a task for this MLT service and resource.
m_blockUpdates
=
true
;
for
(
const
auto
&
task
:
m_taskList
)
{
for
(
AbstractTask
*
t
:
task
.
second
)
{
// If so, then just add ourselves to be notified upon completion.
...
...
@@ -133,6 +140,7 @@ void TaskManager::slotCancelJobs()
m_tasksListLock
.
unlock
();
m_taskPool
.
waitForDone
();
m_transcodePool
.
waitForDone
();
m_blockUpdates
=
false
;
updateJobCount
();
}
...
...
src/jobs/taskmanager.h
View file @
1920dd4c
...
...
@@ -63,6 +63,9 @@ public:
/** @brief Update the number of concurrent jobs allowed */
void
updateConcurrency
();
/** @brief We are aborting all tasks and don't want them to send any updates */
bool
isBlocked
()
const
;
/** @brief return the message of a given job on a given clip (message, detailed log)*/
//QPair<QString, QString> getJobMessageForClip(int jobId, const QString &binId) const;
...
...
@@ -79,6 +82,7 @@ private:
QThreadPool
m_transcodePool
;
std
::
unordered_map
<
int
,
std
::
vector
<
AbstractTask
*>
>
m_taskList
;
mutable
QReadWriteLock
m_tasksListLock
;
bool
m_blockUpdates
;
signals:
void
jobCount
(
int
);
...
...
Write
Preview
Supports
Markdown
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