Permalink
Browse files

Exchanging x->deleteLater; for delete x; for devices since PushDevice…

…sHolder is static and thus its destruction is after the qt main loop has exitted;
  • Loading branch information...
1 parent dc691c7 commit 112a0b89a4224a3cd51a2fba33d39364c285db1a Clovis Scotti committed Apr 28, 2011
@@ -304,6 +304,6 @@ void DevicesManager::SetupAbstractDevices()
RotationCounter * spin2WinKid = new RotationCounter();
configuredDevices->push_back(spin2WinKid);
-// VirtualBrosDevice * virtualBros = new VirtualBrosDevice();
-// configuredDevices->push_back(virtualBros);
+ VirtualBrosDevice * virtualBros = new VirtualBrosDevice();
+ configuredDevices->push_back(virtualBros);
}
@@ -36,13 +36,17 @@ PushDevicesHolder::~PushDevicesHolder()
{
for(int i=0;i<this->count();i++)
{
+ qDebug() << "Calling delete for " << this->at(i)->get_description();
this->at(i)->disconnect_from_backend();
- this->at(i)->deleteLater();
+// this->at(i)->deleteLater()
+ delete this->at(i);
+
}
if(tickDisposer) {
qDebug() << "Calling delete later for tick disposer";
- tickDisposer->deleteLater();
+// tickDisposer->deleteLater();
+ delete tickDisposer;
}
}
@@ -56,7 +56,7 @@ PushN8SimulationDevice::PushN8SimulationDevice()
digitalAcc = false;
timerId = 0;
- timerPeriod = 1;
+ timerPeriod = 20;
}
PushN8SimulationDevice::~PushN8SimulationDevice()
@@ -16,11 +16,12 @@ RotationCounter::RotationCounter(QObject *parent) : PushBurtonGenericDevice(pare
RotationCounter::~RotationCounter()
{
+ qDebug() << "RotationCounter\'s destructor";
}
QString RotationCounter::get_description()
{
- return QString("SpinToWinKid");
+ return QString("RotationCounter");
}
bool RotationCounter::is_online()
@@ -17,22 +17,37 @@ VirtualBrosDevice::VirtualBrosDevice(QObject *parent) :
applausePath = privatePathSymbian + "\\applause.mp3";
#else
- applausePath = "/applause.mp3";
+ applausePath = "applause.mp3";
+ QCoreApplication::setApplicationName(QString("PushSnowboarding"));
#endif
//This loads the file and leaves it in a "ready to play" state.
//Note also that "createPlayer" is the simplest way to playing one sound using Phonon
//and it basically "takes ownership" of the sound sink and that sort of thing so if we
//wanted more sounds playing concurrently we would need to use the less minimalistic calls to phonon.
+
+ qDebug() << "Before creating media";
+
applause = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(applausePath));
+
+ qDebug() << applause->totalTime();
+ qDebug() << applause->errorString();
+
+ if(applause->isValid()) {
+ qDebug() << "is valid";
+ } else {
+ qDebug() << "not valid";
+ }
+
+ qDebug() << "State is: " << applause->state();
+
}
VirtualBrosDevice::~VirtualBrosDevice()
{
if(applause) {
- applause->stop();
-// applause->deleteLater();
+ delete applause;
}
}
@@ -28,7 +28,8 @@
#ifndef VIRTUALBROSDEVICE_H
#define VIRTUALBROSDEVICE_H
-#include <Phonon/Phonon>
+#include <Phonon>
+//#include <Phonon/Phonon>
#include <QString>
#include <typeinfo> //needed by the subscribe mechanism

0 comments on commit 112a0b8

Please sign in to comment.