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

QSoundEffect shouldn't be blocking threads

    XMLWordPrintable

Details

    Description

      In qsoundeffect_pulse_p.cpp, the setMuted and setVolume is emiting while it is locked:

      bool QSoundEffectPrivate::isMuted() const
      {
          QReadLocker locker(&m_volumeLock);
          return m_muted;
      }
      
      void QSoundEffectPrivate::setMuted(bool muted)
      {
          QWriteLocker locker(&m_volumeLock);
          m_muted = muted;
          emit mutedChanged();
      }
      

      So that the emit with AutoConnection or DirectConnection attached to this signal is blocking when also using isMuted or other call.

      One solution can be:

      bool QSoundEffectPrivate::isMuted() const
      {
          QReadLocker locker(&m_volumeLock);
          return m_muted;
      }
      
      void QSoundEffectPrivate::setMuted(bool muted)
      {
          {
              QWriteLocker locker(&m_volumeLock);
              m_muted = muted;
          }
      
          emit mutedChanged();
      }
      

      Or to use regular recursive mutex.

      Attachments

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

        Activity

          People

            valentyn.doroshchuk Valentyn Doroshchuk
            karimpinter Karim Pinter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes