[vlc-commits] qt: don't update the model when the callback comes from another node in NetworkDeviceModel
Pierre Lamot
git at videolan.org
Fri Jan 24 11:37:56 CET 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Jan 20 14:23:25 2020 +0100| [ab05075de5f4460e999f2dc8d179f423a80030b8] | committer: Thomas Guillem
qt: don't update the model when the callback comes from another node in NetworkDeviceModel
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
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ab05075de5f4460e999f2dc8d179f423a80030b8
---
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 )
More information about the vlc-commits
mailing list