Wireshark-commits: [Wireshark-commits] master 9a3676a: Qt: Clear our library path at startup on Win

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Fri, 30 Jan 2015 21:11:08 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9a3676accb141c64fa88b11683d6e0d663df125f
Submitter: Gerald Combs (gerald@xxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

9a3676a by Gerald Combs (gerald@xxxxxxxxxxxxx):

    Qt: Clear our library path at startup on Windows.
    
    I recently rebuilt my Windows development VM and discovered that I could
    no longer run Wireshark executables from wireshark.org. Trying to do so
    failed with the following error:
    
    ----
    This application failed to start because it could not find or load the
    Qt platform plugin "windows".
    
    Available platform plugins are: minimal, offscreen, windows, windows.
    
    Reinstalling the application may fix this problem.
    ----
    
    As it turns out there are two issues. According to
    http://doc.qt.io/qt-5/windows-deployment.html The search path
    for Qt plugins is hard-coded into the QtCore library. Dependency
    Walker confirmed this, showing that Qt5Core.dll tried to load
    C:\Qt\5.3\msvc2013_64_opengl\plugins\platforms\qwindows.dll instead of
    C:\Program Files\Wireshark\platforms\qwindows.dll.
    
    The second issue is that the Qt online installer only uses the major
    and minor version, e.g. C:\Qt\5.3. This means that you can end up with
    Qt 5.3.0, .1, .2, or .3 depending on *when* you run the installer.
    
    The Windows builders have 5.3.1 installed while my development VM
    has 5.3.2. Apparently qwindows.dll is not compatible between these two
    versions, hence the startup error. (...so what happens if you can create
    a malicious qwindows.dll which *is* compatible on someone's machine?)
    
    This change removes any entries from QCoreApplication::libraryPaths that
    don't match our executable path. This shouldn't be an issue in our case
    because both the NMake+QMake and CMake environments run windeployqt to
    copy in any required DLLs.
    
    If it *is* an issue or if clearing the library path list causes other
    problems I can reinstall Qt on the Windows builders into a unique and
    obvious path, e.g. C:\Qt-check-your-path-before-you-wreck-your-path\5.3
    
    Change-Id: I1918bc4e520aba32cfcf9f4ccd37bf9255058cbe
    Reviewed-on: https://code.wireshark.org/review/6863
    Reviewed-by: Gerald Combs <gerald@xxxxxxxxxxxxx>
    

Actions performed:

    from  f61c969   NMake: Add Chocolatey paths.
    adds  9a3676a   Qt: Clear our library path at startup on Windows.


Summary of changes:
 ui/qt/wireshark_application.cpp |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)