[vlc-commits] qt: fix crash when undocking playlist on Wayland + optimization elsewhere

Erwan Tulou git at videolan.org
Sun Dec 17 23:26:40 CET 2017


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Dec 12 14:06:10 2017 +0100| [a420de32234b1517069c717d9cc7885854f7d289] | committer: Jean-Baptiste Kempf

qt: fix crash when undocking playlist on Wayland + optimization elsewhere

Since the video widget is always kept in the main interface, just making
sure it is relocated __before__ moving the playlistwidget to the playlist
dialog saves the two calls to the display server needed to reparent the
native window back and forth at the qt level.

For Wayland, this fixes a crash, since qt is unable to reparent due to
Wayland limitations, anyway.

For other platforms, this is an optimization, since we avoid two useless
often inter-process communications (reparenting back and forth)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a420de32234b1517069c717d9cc7885854f7d289
---

 modules/gui/qt/main_interface.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index 8763d21fc2..3889dedc0e 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -1069,12 +1069,21 @@ void MainInterface::dockPlaylist( bool p_docked )
     if( !p_docked ) /* Previously docked */
     {
         playlistVisible = playlistWidget->isVisible();
-        stackCentralW->removeWidget( playlistWidget );
-        dialog->importPlaylistWidget( playlistWidget );
+
+        /* repositioning the videowidget __before__ exporting the
+           playlistwidget into the playlist dialog avoids two unneeded
+           calls to the server in the qt library to reparent the underlying
+           native window back and forth.
+           For Wayland, this is mandatory since reparenting is not implemented.
+           For X11 or Windows, this is just an optimization. */
         if ( videoWidget && THEMIM->getIM()->hasVideo() )
             showTab(videoWidget);
         else
             showTab(bgWidget);
+
+        /* playlistwidget exported into the playlist dialog */
+        stackCentralW->removeWidget( playlistWidget );
+        dialog->importPlaylistWidget( playlistWidget );
         if ( playlistVisible ) dialog->show();
     }
     else /* Previously undocked */



More information about the vlc-commits mailing list