QSound bug

Report any problems with CopperSpice
Post Reply
seasoned_geek
Posts: 257
Joined: Thu Jun 11 2020 12:18 pm

QSound bug

Post by seasoned_geek »

All,

In an attempt to work around the Beep() being busted, I tried QSound which pulled in/required the entire multimedia library.

Code: Select all

void Overlord::errorBeep()
{
    qDebug() << "errorBeep() called\n";
    //QSound::play( ":/resources/mixkit-attention-bell-ding-586.wav" );
    QSound::play( ":/resources/kling.wav" );
    qDebug() << "errorBeep() completed\n";
}

At first I thought the network message was coming because somehow the .wav file embedded something in it. I took the kling.wav from LibreOffice which is already installed in Linux Mint Mate. Every time I deliberately test the errorBeep() method I see this.

Code: Select all

errorBeep() called

errorBeep() completed

QNetworkRequest::setHeader: QVariant of type QDateTime can not be used with header Last-Modified

  • QSound shouldn't be reaching out to the Internet any time it is passed a local resource file ... ever
  • We need a version of QSound that has all network access removed or at least which can be completely disabled. People shipping applications, especially applications to be used in a secured environment don't want to be opening back doors when they provide user notification sounds.
  • What is QSound trying to "update" with a Last-Modified network header anyway.
Judging from the sequence this is happening in the destructor. I didn't dig too far because it is buried in a private class accessed via a d->

Turns out that isn't even the buried private class one needs.

Code: Select all

roland@roland-HP-Z2-SFF-G4-Workstation:~/github_projects/ls-cs/src/multimedia/audio$ grep -irn qnetwork *
qsamplecache_p.cpp:27:#include <qnetwork_reply.h>
qsamplecache_p.cpp:28:#include <qnetwork_request.h>
qsamplecache_p.cpp:44:QNetworkAccessManager &QSampleCache::networkAccessManager()
qsamplecache_p.cpp:47:      m_networkAccessManager = new QNetworkAccessManager();
qsamplecache_p.cpp:370:   m_stream = m_parent->networkAccessManager().get(QNetworkRequest(m_url));
qsamplecache_p.cpp:371:   connect(m_stream, &QNetworkReply::error, this, &QSample::decoderError);
qsamplecache_p.h:36:class QNetworkAccessManager;
qsamplecache_p.h:37:class QNetworkReply;
qsamplecache_p.h:95:   QNetworkReply  *m_stream;
qsamplecache_p.h:137:   QNetworkAccessManager *m_networkAccessManager;
qsamplecache_p.h:144:   QNetworkAccessManager &networkAccessManager();
roland@roland-HP-Z2-SFF-G4-Workstation:~/github_projects/ls-cs/src/multimedia/audio$ 

We need a simple method of playing .wav files which does not require any network functionality. If one uses this on a stand alone machine with zero network access any attempt at network access can cause things to hang.
Post Reply