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
Multimedia
Kdenlive
Commits
067917f7
Commit
067917f7
authored
Apr 07, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix possible crash or freeze on multiple clip import.
CCBUG: 419603
parent
71d3bdb1
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
067917f7
...
...
@@ -1199,7 +1199,17 @@ bool Bin::eventFilter(QObject *obj, QEvent *event)
m_gainedFocus
=
false
;
if
(
idx
.
isValid
()
&&
m_proxyModel
)
{
std
::
shared_ptr
<
AbstractProjectItem
>
item
=
m_itemModel
->
getBinItemByIndex
(
m_proxyModel
->
mapToSource
(
idx
));
editMasterEffect
(
item
);
if
(
item
->
itemType
()
==
AbstractProjectItem
::
ClipItem
)
{
auto
clip
=
std
::
static_pointer_cast
<
ProjectClip
>
(
item
);
if
(
clip
&&
clip
->
isReady
())
{
editMasterEffect
(
item
);
}
}
else
if
(
item
->
itemType
()
==
AbstractProjectItem
::
SubClipItem
)
{
auto
clip
=
std
::
static_pointer_cast
<
ProjectSubClip
>
(
item
)
->
getMasterClip
();
if
(
clip
&&
clip
->
isReady
())
{
editMasterEffect
(
item
);
}
}
}
else
{
editMasterEffect
(
nullptr
);
}
...
...
src/jobs/cachejob.cpp
View file @
067917f7
...
...
@@ -50,6 +50,7 @@ CacheJob::CacheJob(const QString &binId, int thumbsCount, int inPoint, int outPo
}
m_imageHeight
+=
m_imageHeight
%
2
;
connect
(
this
,
&
CacheJob
::
jobCanceled
,
[
&
]
()
{
QMutexLocker
lk
(
&
m_mutex
);
m_done
=
true
;
m_clipId
.
clear
();
});
...
...
@@ -96,14 +97,16 @@ bool CacheJob::startJob()
int
size
=
(
int
)
frames
.
size
();
int
count
=
0
;
for
(
int
i
:
frames
)
{
if
(
m_done
)
{
break
;
}
emit
jobProgress
(
100
*
count
/
size
);
count
++
;
if
(
ThumbnailCache
::
get
()
->
hasThumbnail
(
m_clipId
,
i
))
{
if
(
m_clipId
.
isEmpty
()
||
ThumbnailCache
::
get
()
->
hasThumbnail
(
m_clipId
,
i
))
{
continue
;
}
m_mutex
.
lock
();
if
(
m_done
)
{
m_mutex
.
unlock
();
break
;
}
m_prod
->
seek
(
i
);
QScopedPointer
<
Mlt
::
Frame
>
frame
(
m_prod
->
get_frame
());
frame
->
set
(
"deinterlace_method"
,
"onefield"
);
...
...
@@ -113,6 +116,7 @@ bool CacheJob::startJob()
QImage
result
=
KThumb
::
getFrame
(
frame
.
data
(),
m_imageWidth
,
m_imageHeight
,
m_fullWidth
);
ThumbnailCache
::
get
()
->
storeThumbnail
(
m_clipId
,
i
,
result
,
true
);
}
m_mutex
.
unlock
();
}
m_done
=
true
;
return
true
;
...
...
src/jobs/cachejob.hpp
View file @
067917f7
...
...
@@ -23,6 +23,7 @@
#include
"abstractclipjob.h"
#include
<QMutex>
#include
<memory>
/* @brief This class represents the job that corresponds to computing the thumb of a clip
...
...
@@ -59,6 +60,7 @@ private:
std
::
shared_ptr
<
ProjectClip
>
m_binClip
;
std
::
shared_ptr
<
Mlt
::
Producer
>
m_prod
;
QMutex
m_mutex
;
bool
m_done
{
false
};
int
m_thumbsCount
;
...
...
src/jobs/thumbjob.cpp
View file @
067917f7
...
...
@@ -53,6 +53,11 @@ ThumbJob::ThumbJob(const QString &binId, int frameNumber, bool persistent, bool
}
else
if
(
item
->
itemType
()
==
AbstractProjectItem
::
SubClipItem
)
{
m_subClip
=
true
;
}
connect
(
this
,
&
ThumbJob
::
jobCanceled
,
[
&
]
()
{
QMutexLocker
lk
(
&
m_mutex
);
m_done
=
true
;
m_clipId
.
clear
();
});
}
const
QString
ThumbJob
::
getDescription
()
const
...
...
@@ -96,6 +101,7 @@ bool ThumbJob::startJob()
m_inCache
=
true
;
return
true
;
}
m_mutex
.
lock
();
m_prod
=
m_binClip
->
thumbProducer
();
if
((
m_prod
==
nullptr
)
||
!
m_prod
->
is_valid
())
{
qDebug
()
<<
"********
\n
COULD NOT READ THUMB PRODUCER
\n
********"
;
...
...
@@ -107,6 +113,10 @@ bool ThumbJob::startJob()
if
(
m_frameNumber
>
0
)
{
m_prod
->
seek
(
m_frameNumber
);
}
if
(
m_done
)
{
m_mutex
.
unlock
();
return
true
;
}
QScopedPointer
<
Mlt
::
Frame
>
frame
(
m_prod
->
get_frame
());
frame
->
set
(
"deinterlace_method"
,
"onefield"
);
frame
->
set
(
"top_field_first"
,
-
1
);
...
...
@@ -115,6 +125,7 @@ bool ThumbJob::startJob()
m_result
=
KThumb
::
getFrame
(
frame
.
data
(),
m_imageWidth
,
m_imageHeight
,
m_fullWidth
);
m_done
=
true
;
}
m_mutex
.
unlock
();
return
m_done
;
}
...
...
src/jobs/thumbjob.hpp
View file @
067917f7
...
...
@@ -24,6 +24,7 @@
#include
"abstractclipjob.h"
#include
<QImage>
#include
<QMutex>
#include
<memory>
/* @brief This class represents the job that corresponds to computing the thumb of a clip
...
...
@@ -63,6 +64,7 @@ private:
std
::
shared_ptr
<
Mlt
::
Producer
>
m_prod
;
QImage
m_result
;
QMutex
m_mutex
;
bool
m_done
{
false
};
bool
m_persistent
;
bool
m_reloadAll
;
...
...
Eugen Mohr
@emohr
mentioned in issue
#616 (closed)
·
Apr 07, 2020
mentioned in issue
#616 (closed)
mentioned in issue #616
Toggle commit list
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