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

Erwan Tulou git at videolan.org
Sun Dec 17 23:36:42 CET 2017


vlc/vlc-3.0 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Dec 12 14:06:10 2017 +0100| [dbded10b41460b09fad134e8d37e7a07425110c9] | 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>
(cherry picked from commit a420de32234b1517069c717d9cc7885854f7d289)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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