Commit 9982db8b authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix freeze when changing bin selection

BUG: 419604
parent 7a856171
...@@ -886,7 +886,7 @@ int GLWidget::setProducer(const QString &file) ...@@ -886,7 +886,7 @@ int GLWidget::setProducer(const QString &file)
qDebug()<<"==== OPENING PROIDUCER FILE: "<<file; qDebug()<<"==== OPENING PROIDUCER FILE: "<<file;
m_producer = std::make_shared<Mlt::Producer>(new Mlt::Producer(pCore->getCurrentProfile()->profile(), nullptr, file.toUtf8().constData())); m_producer = std::make_shared<Mlt::Producer>(new Mlt::Producer(pCore->getCurrentProfile()->profile(), nullptr, file.toUtf8().constData()));
if (m_consumer) { if (m_consumer) {
m_consumer->stop(); //m_consumer->stop();
if (!m_consumer->is_stopped()) { if (!m_consumer->is_stopped()) {
m_consumer->stop(); m_consumer->stop();
} }
...@@ -906,6 +906,10 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i ...@@ -906,6 +906,10 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i
QString currentId; QString currentId;
int consumerPosition = 0; int consumerPosition = 0;
currentId = m_producer->parent().get("kdenlive:id"); currentId = m_producer->parent().get("kdenlive:id");
if (m_consumer) {
consumerPosition = m_consumer->position();
}
stop();
if (producer) { if (producer) {
m_producer = producer; m_producer = producer;
} else { } else {
...@@ -917,27 +921,17 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i ...@@ -917,27 +921,17 @@ int GLWidget::setProducer(const std::shared_ptr<Mlt::Producer> &producer, bool i
rootContext()->setContextProperty("markersModel", 0); rootContext()->setContextProperty("markersModel", 0);
} }
// redundant check. postcondition of above is m_producer != null // redundant check. postcondition of above is m_producer != null
if (m_producer) { m_producer->set_speed(0);
m_producer->set_speed(0); error = reconfigure();
if (m_consumer) { if (error == 0) {
consumerPosition = m_consumer->position(); // The profile display aspect ratio may have changed.
m_consumer->stop(); resizeGL(width(), height());
if (!m_consumer->is_stopped()) {
m_consumer->stop();
}
}
error = reconfigure();
if (error == 0) {
// The profile display aspect ratio may have changed.
resizeGL(width(), height());
}
} else { } else {
return error; return error;
} }
if (!m_consumer) { if (!m_consumer) {
return error; return error;
} }
consumerPosition = m_consumer->position();
if (position == -1 && m_producer->parent().get("kdenlive:id") == currentId) { if (position == -1 && m_producer->parent().get("kdenlive:id") == currentId) {
position = consumerPosition; position = consumerPosition;
} }
......
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