[vlc-devel] [PATCH 4/6] qt: don't update the model when the callback comes from another node in NetworkDeviceModel
Pierre Lamot
pierre at videolabs.io
Mon Jan 20 14:23:25 CET 2020
this fixes issues when we get the callback from a node after we changes view
and end up displaying the content of a folder within the device view
---
modules/gui/qt/network/networkdevicemodel.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt/network/networkdevicemodel.cpp b/modules/gui/qt/network/networkdevicemodel.cpp
index 03fe3d62dc..c82740921d 100644
--- a/modules/gui/qt/network/networkdevicemodel.cpp
+++ b/modules/gui/qt/network/networkdevicemodel.cpp
@@ -209,20 +209,27 @@ bool NetworkDeviceModel::initializeMediaSources()
void NetworkDeviceModel::onItemCleared( MediaSourcePtr mediaSource, input_item_node_t* node )
{
+ if (node != &mediaSource->tree->root)
+ return;
refreshDeviceList( std::move( mediaSource), node->pp_children, node->i_children, true );
}
-void NetworkDeviceModel::onItemAdded( MediaSourcePtr mediaSource, input_item_node_t*,
+void NetworkDeviceModel::onItemAdded( MediaSourcePtr mediaSource, input_item_node_t* parent,
input_item_node_t *const children[],
size_t count )
{
+ if (parent != &mediaSource->tree->root)
+ return;
refreshDeviceList( std::move( mediaSource ), children, count, false );
}
-void NetworkDeviceModel::onItemRemoved(MediaSourcePtr, input_item_node_t*,
+void NetworkDeviceModel::onItemRemoved(MediaSourcePtr mediaSource, input_item_node_t* node,
input_item_node_t *const children[],
size_t count )
{
+ if (node != &mediaSource->tree->root)
+ return;
+
std::vector<InputItemPtr> itemList;
itemList.reserve( count );
for ( auto i = 0u; i < count; ++i )
--
2.17.1
More information about the vlc-devel
mailing list