[vlmc-devel] Fix possible memory leak in MainWorkflow::addEffect
Yikai Lu
git at videolan.org
Fri Jul 29 18:14:23 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul 30 00:07:24 2016 +0900| [ae642f47ad1c426b9e03edf08a9e46f5d9073e57] | committer: Yikai Lu
Fix possible memory leak in MainWorkflow::addEffect
> https://code.videolan.org/videolan/vlmc/commit/ae642f47ad1c426b9e03edf08a9e46f5d9073e57
---
src/Workflow/MainWorkflow.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 0c7d2e0..6b3cfdf 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -339,11 +339,11 @@ MainWorkflow::linkClips( const QString& uuidA, const QString& uuidB )
QString
MainWorkflow::addEffect( const QString &clipUuid, const QString &effectId )
{
- EffectHelper* newEffect = nullptr;
+ std::shared_ptr<EffectHelper> newEffect;
try
{
- newEffect = new EffectHelper( effectId );
+ newEffect.reset( new EffectHelper( effectId ) );
}
catch( Backend::InvalidServiceException& e )
{
@@ -353,9 +353,7 @@ MainWorkflow::addEffect( const QString &clipUuid, const QString &effectId )
for ( auto clip : m_clips )
if ( clip->uuid().toString() == clipUuid )
{
- trigger( new Commands::Effect::Add(
- std::shared_ptr<EffectHelper>( newEffect ), clip->input() )
- );
+ trigger( new Commands::Effect::Add( newEffect, clip->input() ) );
return newEffect->uuid().toString();
}
More information about the Vlmc-devel
mailing list