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

QSoundEffect::setSource() crashes the app if no audio output is available in Qt6

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • 6.2.4
    • 6.2.2
    • Multimedia
    • None
    • Windows
    • e95f7256fb534c3dd03b3091dd9835cd2f33d327

    Description

      There is a problem with Qt6's QSoundEffect (6.2.2 is what I used) which seems to be absent in Qt5 (5.15.1 is what I checked) and which causes application to shut down if in the Windows 10 system there is no audio output active (indicated e.g. by the speaker icon in the taskbar being crossed out).

      In such a setting calling the setSource() on QSoundEffect instance causes the app to be shut down.

      The problem can be even reproduced using the official Qt example 'audiodecoder' but as the code there is somewhat involved I attach the simple single-file demo of the problem (the compete .pro settings present in the header of the file).

      Execution of the demo requires presence of 'some.wav' file in the runtime directory.

      There also seems to be a simple workaround to detect the problematic situation without introducing new dependencies - if 'QSoundEffect::supportedMimeTypes().size()' reports 0 the 'setSource' should not be called (that is used in the demo to add a warning text to the button).

      As I mentioned, in Qt5, when no output is connected the effect just seems to 'do nothing'.

      Please consult the code for any further details.

      Attachments

        1. recon_qsoundeffect.h
          2 kB
          Wojciech Ziembla

        Issue Links

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

          Activity

            People

              laknoll Lars Knoll
              woj Wojciech Ziembla
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes