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

Thread local storage (TLS) index leak on windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.5, 5.14.0 Alpha
    • 5.12.4, 5.13.0
    • Core: Threads
    • None
    • Windows
    • 64d949207686a0225a78de572548a5361e340ae3 (qt/qtbase/5.12)

    Description

      qt_current_thread_data_tls_index is created by qt_create_tls() function.

      If qt_create_tls() is called by multiple threads at the same time, qt_current_thread_data_tls_index may be created multiple times, and only the last one is saved, the others are leaked.

      The code could be changed as follows.

      void qt_create_tls()
      {
       if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES)
         return;
       static QBasicMutex mutex;
       QMutexLocker locker(&mutex);
       if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES)
         return;
       qt_current_thread_data_tls_index = TlsAlloc();
      }

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            zhouyu Yu Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes