#else
WaitForSingleObject(boxLock, INFINITE);
#endif
+ Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for add");
if (numBoxes == 16) return 0;
boxes[numBoxes++] = v;
ReleaseMutex(boxLock);
#endif
+ Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for add");
+
return 1;
}
int BoxStack::remove(Boxx* toDelete)
{
if (!initted) return 0;
-
+
+ toDelete->preDelete();
+
#ifndef WIN32
pthread_mutex_lock(&boxLock);
#else
WaitForSingleObject(boxLock, INFINITE);
#endif
+ Log::getInstance()->log("BoxStack", Log::DEBUG, "Locked for remove");
- if (numBoxes == 0) return 0;
+ if (numBoxes == 0)
+ { // FIXME
+ #ifndef WIN32
+ pthread_mutex_unlock(&boxLock);
+ #else
+ ReleaseMutex(boxLock);
+ #endif
+ Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for remove");
+ return 0;
+ }
// Log::getInstance()->log("BoxStack", Log::DEBUG, "entering remove, numBoxes=%i", numBoxes);
if (i == -1)
{
// not a Box we have!
- return 0;
+ { // FIXME
+ #ifndef WIN32
+ pthread_mutex_unlock(&boxLock);
+ #else
+ ReleaseMutex(boxLock);
+ #endif
+ Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for remove");
+ return 0;
+ }
}
}
#else
ReleaseMutex(boxLock);
#endif
+ Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for remove");
return 1;
}
rl.pop_front();
}
- Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocking");
#ifndef WIN32
pthread_mutex_unlock(&boxLock);
#else
ReleaseMutex(boxLock);
#endif
+ Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update");
}
void BoxStack::repaintRevealed(int x, Region r)
// The following are supposed to be abstract functions
// However, it is useful to be able to make instances of Boxx
// Therefore the following stubs are provided.
+ virtual void preDelete() {}
virtual int handleCommand(int x) { return 0; }
virtual void processMessage(Message* m) {}
virtual bool mouseMove(int x, int y) { return false; }
virtual bool mouseLBDOWN(int x, int y) { return false; }
virtual void deactivateAllControls() {}
+ /* preDelete
+
+ I think it's functionally equivalent to e.g. delete timers in Boxx::preDelete
+ because the only place where a Boxx is deleted is in
+ BoxStack::remove. There is now a call in BoxStack::remove to Boxx::preDelete
+ The reason for this is to stop timercalls calling BoxStack::update at the
+ same time BoxStack::remove is locked trying to delete the Boxx
+ */
// Get functions
int getScreenX(); // where is it on screen
return rt;
}
+void VAudioplayer::preDelete()
+{
+ // Another note from Chris:
+ // I have moved these timer cancels here from the destructor, please see boxx.h
+
+ Timers::getInstance()->cancelTimer(this,1);
+ Timers::getInstance()->cancelTimer(this,2);
+ Timers::getInstance()->cancelTimer(this,3);
+}
+
VAudioplayer::~VAudioplayer()
{
// Note from Chris:
if (banner) BoxStack::getInstance()->remove(banner);
if (fullname) delete fullname;
if (filename) delete filename;
- Timers::getInstance()->cancelTimer(this,1);
- Timers::getInstance()->cancelTimer(this,2);
- Timers::getInstance()->cancelTimer(this,3);
+
+
//TODO leave this to medialist and stop only...
if (getPlayer(false)) {
AudioPlayer::getInstance(NULL,false)->shutdown();
void processMessage(Message* m);
int handleCommand(int command);
+ void preDelete();
void draw();
void timercall(int clientReference);
//factory method
updateEventList(); // get list of programmes
}
-VEpg::~VEpg()
+void VEpg::preDelete()
{
Timers::getInstance()->cancelTimer(this, 1);
+}
+
+VEpg::~VEpg()
+{
instance = NULL;
~VEpg();
static VEpg* getInstance();
+ void preDelete();
int handleCommand(int command); // deal with commands (from remote control)
void draw(); // draw epg view
void processMessage(Message* m);
add(&jpeg);
}
+void VPicture::preDelete()
+{
+ Timers::getInstance()->cancelTimer(this,1);
+ Timers::getInstance()->cancelTimer(this,2);
+ Timers::getInstance()->cancelTimer(this,3);
+}
+
VPicture::~VPicture()
{
delete reader;
if (banner) BoxStack::getInstance()->remove(banner);
if (fullname) delete fullname;
if (filename) delete filename;
- Timers::getInstance()->cancelTimer(this,1);
- Timers::getInstance()->cancelTimer(this,2);
- Timers::getInstance()->cancelTimer(this,3);
+
destroyInfo();
}
public:
~VPicture();
+ void preDelete();
void processMessage(Message* m);
int handleCommand(int command);
void draw();
barShowing = false;
}
+void VRadioRec::preDelete()
+{
+ timers->cancelTimer(this, 1);
+ timers->cancelTimer(this, 2);
+}
+
VRadioRec::~VRadioRec()
{
if (playing) stopPlay();
- timers->cancelTimer(this, 1);
- timers->cancelTimer(this, 2);
// kill recInfo in case resumePoint has changed (likely)
myRec->dropRecInfo();
VRadioRec(Recording* rec);
~VRadioRec();
void draw();
+ void preDelete();
int handleCommand(int command);
void go();
add(&sl);
}
-VTimerList::~VTimerList()
+void VTimerList::preDelete()
{
Timers::getInstance()->cancelTimer(this, 1);
+}
+
+VTimerList::~VTimerList()
+{
if (recTimerList)
{
for (UINT i = 0; i < recTimerList->size(); i++)
public:
VTimerList();
~VTimerList();
+ void preDelete();
int handleCommand(int command);
void timercall(int clientReference);
osdSummaryRegion = r1 + r2;
}
-VVideoLiveTV::~VVideoLiveTV()
+void VVideoLiveTV::preDelete()
{
if (playing) stop();
+}
+VVideoLiveTV::~VVideoLiveTV()
+{
delete player;
video->setDefaultAspect();
delData();
public:
VVideoLiveTV(ChannelList* chanList, ULONG initialChannelNumber, VChannelList* vchannelList);
~VVideoLiveTV();
+ void preDelete();
int handleCommand(int command);
void processMessage(Message* m);
}
}
+void VVideoRec::preDelete()
+{
+ timers->cancelTimer(this, 1);
+ timers->cancelTimer(this, 2);
+}
+
VVideoRec::~VVideoRec()
{
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
if (playing) stopPlay();
video->setDefaultAspect();
- timers->cancelTimer(this, 1);
- timers->cancelTimer(this, 2);
-
// kill recInfo in case resumePoint has changed (likely)
myRec->dropRecInfo();
// FIXME - do this properly - save the resume point back to the server manually and update
public:
VVideoRec(Recording* rec);
~VVideoRec();
+ void preDelete();
int handleCommand(int command);
void go(bool resume);
add(&jpeg);
}
-VWelcome::~VWelcome()
+void VWelcome::preDelete()
{
Timers::getInstance()->cancelTimer(this, 1);
}
+VWelcome::~VWelcome()
+{
+}
+
void VWelcome::draw()
{
TBBoxx::draw();
~VWelcome();
void create();
-
+ void preDelete();
int handleCommand(int command);
void processMessage(Message* m);
void draw();