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

QLocalSocket may not return correct error code through error() function

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.9.7
    • Fix Version/s: 5.12
    • Component/s: Network: Sockets
    • Labels:
      None
    • Environment:
    • Platform/s:
      Windows
    • Commits:
      cbac5a1a6edfd0d7a1e351bbe50bab118d1155e5

      Description

      In Windows version of QLocalSocket (qlocalsocket_win.cpp), whenever error occurs, error is recorded by calling setErrorString(QLatin1String(...)) and GetLastError() is called in the  setErrorString() function to determine the type of the error.

      But, as QLatin1String(...) may cause system call (for memory allocation, I guess), that GetLastError() will no longer return the original error code (instead, returns ERROR_SUCCESS for the memory allocation system call).  As a result,  QLocalSocketPrivate::_q_winError() sets error = QLocalSocket::UnknownSocketError regardless of the original error type.  And, when QLocalSocket::error() is called later, I get QLocalSocket::UnknownSocketError.

        Attachments

        For Gerrit Dashboard: QTBUG-71744
        # Subject Branch Project Status CR V

          Activity

            People

            • Assignee:
              tpochep Timur Pocheptsov
              Reporter:
              sarai Susumu Arai
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes