Hi all,
I have a problem with using phonon after restarting application.
I have created singleton pattern class which holds voice messages for application. This class inherits from QObject to allow connection of signals and slots. Everything works fine in normal operation. However when i restart the application programatically with use of the following technique:
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. int currentExitCode = 0;
  4.  
  5. do{
  6. QApplication a(argc, argv);
  7. qApp->setQuitOnLastWindowClosed(true);
  8.  
  9. SoundPlayer::instance()->loadSounds();
  10. bool success;
  11. MainWindow w(success);
  12. if(success)
  13. currentExitCode=a.exec();
  14. else
  15. qApp->exit();
  16.  
  17. }while( currentExitCode == MainWindow::EXIT_CODE_REBOOT );
  18.  
  19. return currentExitCode;
  20. }
  21.  
  22. (..)
  23.  
  24. void SoundPlayer::loadSounds()
  25. {
  26. unloadSounds();
  27.  
  28. QString dirfilename = "sound.mp3";
  29. if(QFile::exists(dirfilename))
  30. {
  31. qDebug()<<Phonon::phononVersion();
  32.  
  33. sounds.insert(estSound1 ,Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource(dirfilename)));
  34. connect(sounds[estSound1],SIGNAL(finished()),this, SLOT(rewindPlayer()));
  35. }
  36. }
To copy to clipboard, switch view to plain text mode 

When the application restarts and the execution reaches loadSounds(), the error arises at:

Qt Code:
  1. Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource(dirfilename))
To copy to clipboard, switch view to plain text mode 

with message:


Fatal Error: Accessed global static 'Phonon::FactoryPrivate *globalFactory()' after destruction. Defined at ../3rdparty/phonon/phonon/factory.cpp:84
the same error appears when i try to execute any of:
Qt Code:
  1. Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput();
  2. Phonon::MediaObject *mo = new Phonon::MediaObject(this);
To copy to clipboard, switch view to plain text mode 

after restart.

Do you have any idea what can be wrong?
Best regards,
Konrad