[vlmc-devel] ConsoleRenderer: Don't quit the application from ConsoleRenderer
Yikai Lu
git at videolan.org
Fri Jun 9 14:07:30 CEST 2017
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Fri Jun 9 20:57:22 2017 +0900| [0a2a780211b8dc7752e271bbae566f843a12aa1d] | committer: Yikai Lu
ConsoleRenderer: Don't quit the application from ConsoleRenderer
In the previous code, the app won't quit properly because it's done by a wrong thread
> https://code.videolan.org/videolan/vlmc/commit/0a2a780211b8dc7752e271bbae566f843a12aa1d
---
Makefile.am | 1 +
src/Main/main.cpp | 1 +
src/Renderer/ConsoleRenderer.cpp | 4 +---
src/Renderer/ConsoleRenderer.h | 3 +++
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 7071fdfa..56704600 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -101,6 +101,7 @@ nodist_vlmc_SOURCES = \
src/Settings/Settings.moc.cpp \
src/Media/Media.moc.cpp \
src/Renderer/AbstractRenderer.moc.cpp \
+ src/Renderer/ConsoleRenderer.moc.cpp \
src/Project/WorkspaceWorker.moc.cpp \
src/Services/AbstractSharingService.moc.cpp \
src/Workflow/MainWorkflow.moc.cpp \
diff --git a/src/Main/main.cpp b/src/Main/main.cpp
index 5fbf4c2f..f6389c70 100644
--- a/src/Main/main.cpp
+++ b/src/Main/main.cpp
@@ -212,6 +212,7 @@ VLMCCoremain( int argc, char **argv )
Project *p = Core::instance()->project();
QCoreApplication::connect( p, &Project::projectLoaded, &renderer, &ConsoleRenderer::startRender );
+ QCoreApplication::connect( &renderer, &ConsoleRenderer::finished, &app, &QCoreApplication::quit, Qt::QueuedConnection );
Core::instance()->settings()->load();
p->load( app.arguments()[1] );
diff --git a/src/Renderer/ConsoleRenderer.cpp b/src/Renderer/ConsoleRenderer.cpp
index ad21cbc8..ee4e48cf 100644
--- a/src/Renderer/ConsoleRenderer.cpp
+++ b/src/Renderer/ConsoleRenderer.cpp
@@ -30,15 +30,12 @@
#include "Tools/VlmcDebug.h"
#include "Workflow/MainWorkflow.h"
-#include <QCoreApplication>
-
ConsoleRenderer::ConsoleRenderer( const QString& outputFileName, QObject *parent )
: QObject( parent )
, m_outputFileName( outputFileName )
{
connect( Core::instance()->workflow(), &MainWorkflow::frameChanged,
this, &ConsoleRenderer::frameChanged, Qt::DirectConnection );
- connect( Core::instance()->workflow(), &MainWorkflow::mainWorkflowEndReached, qApp, &QCoreApplication::quit );
}
void
@@ -69,4 +66,5 @@ ConsoleRenderer::startRender()
project->nbChannels(),
project->sampleRate()
);
+ emit finished();
}
diff --git a/src/Renderer/ConsoleRenderer.h b/src/Renderer/ConsoleRenderer.h
index 57350ee2..e005bc55 100644
--- a/src/Renderer/ConsoleRenderer.h
+++ b/src/Renderer/ConsoleRenderer.h
@@ -40,6 +40,9 @@ private:
private:
QString m_outputFileName;
+
+signals:
+ void finished();
};
#endif // CONSOLERENDERER_H
More information about the Vlmc-devel
mailing list