Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-77406

QCoreApplication::arguments() no longer returns correct arguments for unicode windows app

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.12.3
    • None
    • Visual Studio 2017, Windows 10
    • Windows

    Description

      This used to work in Qt 5.4.1 but after updating to Qt 5.12.3 it no longer works.

      // this no longer works and QCoreApplication::arguments() does not return the right arguments
      int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow )
      {
          return MyApplication::launchGUI(__argc, (char**)__wargv);
      }
       
      // this works
      int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nCmdShow )
      {
          return MyApplication::launchGUI(__argc, (char**)__argv);
      }
      

      If I print __argc, __argv and __wargv, the wWinMain entry point version will have __wargv set instead of __argv whereas for the WinMain entry point version, __argv is set instead of __wargv.

      Stepping through QCoreApplication's code, in isArgvModified(), it doesn't seem to check for __wargv this leads to origArgv not getting initialized which leads to arguments() skipping over the code that could have returned the correct arguments based on my testing (by having isArgModified return false).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            thuan_firelight Thuan Seah
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes