Commit 8cd806fd authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MediaLibrary: Ensure the parser is stopped before tearing down

parent 5d17447d
......@@ -95,6 +95,8 @@ MediaLibrary::~MediaLibrary()
// Explicitely stop the discoverer, to avoid it writting while tearing down.
if ( m_discoverer != nullptr )
m_discoverer->stop();
if ( m_parser != nullptr )
m_parser->stop();
Media::clear();
Folder::clear();
Label::clear();
......
......@@ -44,14 +44,7 @@ Parser::Parser( MediaLibrary* ml )
Parser::~Parser()
{
for ( auto& s : m_services )
{
s->signalStop();
}
for ( auto& s : m_services )
{
s->stop();
}
stop();
}
void Parser::addService( ServicePtr service )
......@@ -88,6 +81,18 @@ void Parser::resume()
s->resume();
}
void Parser::stop()
{
for ( auto& s : m_services )
{
s->signalStop();
}
for ( auto& s : m_services )
{
s->stop();
}
}
void Parser::restore()
{
if ( m_services.empty() == true )
......
......@@ -52,6 +52,7 @@ public:
void start();
void pause();
void resume();
void stop();
private:
// Queues all unparsed files for parsing.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment