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
f6ae3b0d
Commit
f6ae3b0d
authored
Jul 13, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix crash dropping clip in timeline
Fixes
#1087
parent
86aa0fd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/jobs/cliploadtask.cpp
View file @
f6ae3b0d
...
...
@@ -47,13 +47,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KMessageWidget>
ClipLoadTask
::
ClipLoadTask
(
const
ObjectId
&
owner
,
const
QDomElement
&
xml
,
bool
thumbOnly
,
int
in
,
int
out
,
QObject
*
object
,
std
::
function
<
void
()
>
readyCallBack
)
ClipLoadTask
::
ClipLoadTask
(
const
ObjectId
&
owner
,
const
QDomElement
&
xml
,
bool
thumbOnly
,
int
in
,
int
out
,
QObject
*
object
)
:
AbstractTask
(
owner
,
AbstractTask
::
LOADJOB
,
object
)
,
m_xml
(
xml
)
,
m_in
(
in
)
,
m_out
(
out
)
,
m_thumbOnly
(
thumbOnly
)
,
m_readyCallBack
(
std
::
move
(
readyCallBack
))
{
QObject
::
connect
(
this
,
&
ClipLoadTask
::
proposeTranscode
,
this
,
&
ClipLoadTask
::
doProposeTranscode
,
Qt
::
QueuedConnection
);
}
...
...
@@ -64,7 +63,7 @@ ClipLoadTask::~ClipLoadTask()
void
ClipLoadTask
::
start
(
const
ObjectId
&
owner
,
const
QDomElement
&
xml
,
bool
thumbOnly
,
int
in
,
int
out
,
QObject
*
object
,
bool
force
,
std
::
function
<
void
()
>
readyCallBack
)
{
ClipLoadTask
*
task
=
new
ClipLoadTask
(
owner
,
xml
,
thumbOnly
,
in
,
out
,
object
,
readyCallBack
);
ClipLoadTask
*
task
=
new
ClipLoadTask
(
owner
,
xml
,
thumbOnly
,
in
,
out
,
object
);
if
(
!
thumbOnly
&&
pCore
->
taskManager
.
hasPendingJob
(
owner
,
AbstractTask
::
LOADJOB
))
{
delete
task
;
task
=
0
;
...
...
@@ -73,6 +72,9 @@ void ClipLoadTask::start(const ObjectId &owner, const QDomElement &xml, bool thu
// Otherwise, start a new audio levels generation thread.
task
->
m_isForce
=
force
;
pCore
->
taskManager
.
startTask
(
owner
.
second
,
task
);
connect
(
task
,
&
ClipLoadTask
::
taskDone
,
[
readyCallBack
]()
{
QMetaObject
::
invokeMethod
(
qApp
,
[
readyCallBack
]{
readyCallBack
();});
});
}
}
...
...
@@ -666,7 +668,7 @@ void ClipLoadTask::run()
}
generateThumbnail
(
binClip
,
producer
);
m_readyCallBack
();
emit
taskDone
();
if
(
pCore
->
projectItemModel
()
->
clipsCount
()
==
1
)
{
// Always select first added clip
pCore
->
selectBinClip
(
QString
::
number
(
m_owner
.
second
),
false
);
...
...
src/jobs/cliploadtask.h
View file @
f6ae3b0d
...
...
@@ -38,7 +38,7 @@ class ClipLoadTask : public AbstractTask
{
Q_OBJECT
public:
ClipLoadTask
(
const
ObjectId
&
owner
,
const
QDomElement
&
xml
,
bool
thumbOnly
,
int
in
,
int
out
,
QObject
*
object
,
std
::
function
<
void
()
>
readyCallBack
);
ClipLoadTask
(
const
ObjectId
&
owner
,
const
QDomElement
&
xml
,
bool
thumbOnly
,
int
in
,
int
out
,
QObject
*
object
);
virtual
~
ClipLoadTask
();
static
void
start
(
const
ObjectId
&
owner
,
const
QDomElement
&
xml
,
bool
thumbOnly
,
int
in
,
int
out
,
QObject
*
object
,
bool
force
=
false
,
std
::
function
<
void
()
>
readyCallBack
=
[]()
{});
static
ClipType
::
ProducerType
getTypeForService
(
const
QString
&
id
,
const
QString
&
path
);
...
...
@@ -61,13 +61,13 @@ private:
int
m_in
;
int
m_out
;
bool
m_thumbOnly
;
std
::
function
<
void
()
>
m_readyCallBack
;
QString
m_errorMessage
;
void
generateThumbnail
(
std
::
shared_ptr
<
ProjectClip
>
binClip
,
std
::
shared_ptr
<
Mlt
::
Producer
>
producer
);
void
abort
();
signals:
void
proposeTranscode
(
const
QString
&
resource
);
void
taskDone
();
};
#endif // CLIPLOADTASK_H
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