fixed possible deadlock when closing osd with blinking element

This commit is contained in:
louis 2016-03-03 23:37:23 +01:00
parent f2c492d81c
commit cdc1c10204
5 changed files with 15 additions and 2 deletions

View File

@ -342,7 +342,7 @@ void cAnimation::Blink(void) {
Sleep(freq);
if (Running()) {
blinkable->DoBlink(blinkFunc, blinkOn);
blinkable->Flush();
blinkable->Flush();
}
blinkOn = !blinkOn;
}

View File

@ -42,6 +42,7 @@ public:
bool ActiveTab(void) { return activeTab; };
virtual int GetWidth(void) { return 0; };
virtual void Cache(void) {};
virtual void StopBlinkers(void) {};
virtual void Close(void) {};
virtual void Clear(void) {};
virtual void Hide(void) {};
@ -82,7 +83,6 @@ private:
void CreatePixmap(cRect drawPort = cRect::Null);
void SetScrollFunc(void);
void StartBlinkers(void);
void StopBlinkers(void);
public:
cArea(void);
cArea(const cArea &other);
@ -131,6 +131,7 @@ public:
//Blinkable
int BlinkFreq(int func);
void DoBlink(int func, bool on);
void StopBlinkers(void);
//Common
const char *Name(void) { return attribs->Name(); };
bool BackgroundArea(void) { return attribs->BackgroundArea(); };

View File

@ -215,6 +215,11 @@ void cView::Render(int ve, bool force) {
}
void cView::Close(void) {
for (int i=0; i < numViewElements; i++) {
if (!viewElements[i])
continue;
viewElements[i]->StopBlinking();
}
delete fader;
fader = NULL;
delete shifter;

View File

@ -319,6 +319,12 @@ void cViewElement::Close(void) {
blocked = false;
}
void cViewElement::StopBlinking(void) {
for (cAreaNode *node = areaNodes.First(); node; node = areaNodes.Next(node)) {
node->StopBlinkers();
}
}
void cViewElement::Render(void) {
if (!dirty || blocked)
return;

View File

@ -61,6 +61,7 @@ public:
void SetAreaHeight(int height);
void Cache(void);
virtual void Close(void);
void StopBlinking(void);
virtual void Clear(void);
void Hide(void);
void Show(void);