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
d42c36e5
Commit
d42c36e5
authored
Sep 02, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix crash when clip is modified by external app
parent
3239b0bf
Pipeline
#226177
passed with stage
in 10 minutes and 10 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/filewatcher.cpp
View file @
d42c36e5
...
...
@@ -13,7 +13,7 @@ FileWatcher::FileWatcher(QObject *parent)
,
m_fileWatcher
(
new
KDirWatch
)
{
// Init clip modification tracker
m_modifiedTimer
.
setInterval
(
15
00
);
m_modifiedTimer
.
setInterval
(
20
00
);
connect
(
m_fileWatcher
.
get
(),
&
KDirWatch
::
dirty
,
this
,
&
FileWatcher
::
slotUrlModified
);
connect
(
m_fileWatcher
.
get
(),
&
KDirWatch
::
deleted
,
this
,
&
FileWatcher
::
slotUrlMissing
);
connect
(
m_fileWatcher
.
get
(),
&
KDirWatch
::
created
,
this
,
&
FileWatcher
::
slotUrlAdded
);
...
...
src/bin/projectclip.cpp
View file @
d42c36e5
...
...
@@ -71,6 +71,7 @@ RTTR_REGISTRATION
ProjectClip
::
ProjectClip
(
const
QString
&
id
,
const
QIcon
&
thumb
,
const
std
::
shared_ptr
<
ProjectItemModel
>
&
model
,
std
::
shared_ptr
<
Mlt
::
Producer
>
producer
)
:
AbstractProjectItem
(
AbstractProjectItem
::
ClipItem
,
id
,
model
)
,
ClipController
(
id
,
producer
)
,
isReloading
(
false
)
,
m_resetTimelineOccurences
(
false
)
,
m_audioCount
(
0
)
,
m_uuid
(
QUuid
::
createUuid
())
...
...
@@ -142,6 +143,7 @@ void ProjectClip::importEffects(const std::shared_ptr<Mlt::Producer> &producer,
ProjectClip
::
ProjectClip
(
const
QString
&
id
,
const
QDomElement
&
description
,
const
QIcon
&
thumb
,
const
std
::
shared_ptr
<
ProjectItemModel
>
&
model
)
:
AbstractProjectItem
(
AbstractProjectItem
::
ClipItem
,
id
,
model
)
,
ClipController
(
id
)
,
isReloading
(
false
)
,
m_resetTimelineOccurences
(
false
)
,
m_audioCount
(
0
)
,
m_uuid
(
QUuid
::
createUuid
())
...
...
@@ -423,6 +425,7 @@ void ProjectClip::reloadProducer(bool refreshOnly, bool isProxy, bool forceAudio
}
}
m_audioThumbCreated
=
false
;
isReloading
=
true
;
// Reset uuid to enforce reloading thumbnails from qml cache
m_uuid
=
QUuid
::
createUuid
();
if
(
forceAudioReload
||
(
!
isProxy
&&
hashChanged
))
{
...
...
@@ -539,6 +542,7 @@ bool ProjectClip::setProducer(std::shared_ptr<Mlt::Producer> producer, bool gene
}
// Make sure we have a hash for this clip
updateProducer
(
producer
);
isReloading
=
false
;
getFileHash
();
emit
producerChanged
(
m_binId
,
producer
);
m_thumbsProducer
.
reset
();
...
...
src/bin/projectclip.h
View file @
d42c36e5
...
...
@@ -69,6 +69,11 @@ public:
*/
const
QString
getProxyFromOriginal
(
QString
originalPath
)
const
;
/**
* @brief True if we started a clip reload
*/
bool
isReloading
;
protected:
ProjectClip
(
const
QString
&
id
,
const
QIcon
&
thumb
,
const
std
::
shared_ptr
<
ProjectItemModel
>
&
model
,
std
::
shared_ptr
<
Mlt
::
Producer
>
producer
);
ProjectClip
(
const
QString
&
id
,
const
QDomElement
&
description
,
const
QIcon
&
thumb
,
const
std
::
shared_ptr
<
ProjectItemModel
>
&
model
);
...
...
src/jobs/cliploadtask.cpp
View file @
d42c36e5
...
...
@@ -480,9 +480,12 @@ void ClipLoadTask::run()
if
(
producer
)
{
producer
.
reset
();
}
QMetaObject
::
invokeMethod
(
pCore
.
get
(),
"displayBinMessage"
,
Qt
::
QueuedConnection
,
Q_ARG
(
QString
,
m_errorMessage
.
isEmpty
()
?
i18n
(
"Cannot open file %1"
,
resource
)
:
m_errorMessage
),
Q_ARG
(
int
,
int
(
KMessageWidget
::
Warning
)));
auto
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
QString
::
number
(
m_owner
.
second
));
if
(
binClip
&&
!
binClip
->
isReloading
)
{
QMetaObject
::
invokeMethod
(
pCore
.
get
(),
"displayBinMessage"
,
Qt
::
QueuedConnection
,
Q_ARG
(
QString
,
m_errorMessage
.
isEmpty
()
?
i18n
(
"Cannot open file %1"
,
resource
)
:
m_errorMessage
),
Q_ARG
(
int
,
int
(
KMessageWidget
::
Warning
)));
}
emit
taskDone
();
abort
();
return
;
...
...
@@ -760,7 +763,7 @@ void ClipLoadTask::abort()
auto
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
QString
::
number
(
m_owner
.
second
));
if
(
binClip
)
{
QMetaObject
::
invokeMethod
(
binClip
.
get
(),
"setInvalid"
,
Qt
::
QueuedConnection
);
if
(
!
m_isCanceled
.
loadAcquire
())
{
if
(
!
m_isCanceled
.
loadAcquire
()
&&
!
binClip
->
isReloading
)
{
// User tried to add an invalid clip, remove it.
pCore
->
projectItemModel
()
->
requestBinClipDeletion
(
binClip
,
undo
,
redo
);
}
else
{
...
...
src/jobs/filtertask.cpp
View file @
d42c36e5
...
...
@@ -81,8 +81,10 @@ void FilterTask::run()
}
if
((
producer
==
nullptr
)
||
!
producer
->
is_valid
())
{
// Clip was removed or something went wrong
QMetaObject
::
invokeMethod
(
pCore
.
get
(),
"displayBinMessage"
,
Qt
::
QueuedConnection
,
Q_ARG
(
QString
,
i18n
(
"Cannot open file %1"
,
binClip
->
url
())),
Q_ARG
(
int
,
int
(
KMessageWidget
::
Warning
)));
if
(
!
binClip
->
isReloading
)
{
QMetaObject
::
invokeMethod
(
pCore
.
get
(),
"displayBinMessage"
,
Qt
::
QueuedConnection
,
Q_ARG
(
QString
,
i18n
(
"Cannot open file %1"
,
binClip
->
url
())),
Q_ARG
(
int
,
int
(
KMessageWidget
::
Warning
)));
}
pCore
->
taskManager
.
taskDone
(
m_owner
.
second
,
this
);
return
;
}
...
...
Davy Bartoloni
🍕
@bartoloni
mentioned in issue
#1507 (closed)
·
Sep 07, 2022
mentioned in issue
#1507 (closed)
mentioned in issue #1507
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