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

QAudioOutput::start() crashes when the QIODevice is destructed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.1
    • 4.6.0
    • Multimedia
    • None

    Description

      It QAudioOutput::start() has been reported to crash while playing a file. This happen when the QIODevice is destructed after a call to QAudioOutput::start().

      The documentation have a similar example :

      {
       QFile inputFile;
       inputFile.setFileName("/tmp/test.raw");
       inputFile.open(QIODevice::ReadOnly);
      
       QAudioFormat format;
       // Set up the format, eg.
       format.setFrequency(8000);
       format.setChannels(1);
       format.setSampleSize(8);
       format.setCodec("audio/pcm");
       format.setByteOrder(QAudioFormat::LittleEndian);
       format.setSampleType(QAudioFormat::UnSignedInt);
      
       QAudioOutput *audio = new QAudioOutput(format, this);
       connect(audio,SIGNAL(stateChanged(QAudio::State)),SLOT(finishedPlaying(QAudio::State)));
       audio->start(inputFile);
      }
      

      Users copies this code inside a function, and the applications crashes when QFile is out of scope at the end of the function.

      It would be nice to improve the documentation and/or to handle this case nicely when QIODevice::aboutToClose() is sent.

      Attachments

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

        Activity

          People

            korbatit Kurt Korbatits (closed Nokia identity) (Inactive)
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes