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

SIGNAL and SLOT macro are not threadsafe in Debug mode

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.2.0
    • 4.5.0
    • Core: Object Model
    • None
    • c012ee2940bc087720b4aa0d257540921cf9a139

    Description

      In Debug mode, SIGNAL() and SLOT() are not threadsafe.

      In Debug, the macro uses qFlagLocation():

      1. define METHOD(a) qFlagLocation("0"#a QLOCATION)
      2. define SLOT(a) qFlagLocation("1"#a QLOCATION)
      3. define SIGNAL(a) qFlagLocation("2"#a QLOCATION)

      First, this function use a static integer for the index:
      static int idx = 0;
      This variable is subject to race condition.

      Secondly, the variable "flagged_locations" is global and is subject to race condition.

      These two problem can lead to erroneous error message when a connection cannot be made. They can be corrected by using thread local storage for the two variable.

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes