fixed crashes if main menu is opened consecutively

This commit is contained in:
louis 2015-07-15 19:08:05 +02:00
parent ac3f69c01e
commit 65b61b4e2b
7 changed files with 25 additions and 1 deletions

View File

@ -392,4 +392,6 @@ Version 0.6.1
- changed skinrepository from static file to github repository
- fixed flickering when main menu is fading
- some changes in metrixHD
- changed font in metrixhd from "VDROpen Sans" to "Open Sans"
- fixed crashes if main menu is opened consecutively

View File

@ -73,6 +73,8 @@ void cDisplayMenuItemView::EndScrolling(void) {
void cDisplayMenuItemView::Action(void) {
if (scrolling) {
DoSleep(scrollDelay);
if (!Running())
return;
PrepareScrolling();
if (scrollOrientation == orHorizontal) {
ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode);

View File

@ -84,10 +84,12 @@ int cDisplayMenuListView::GetListWidth(void) {
void cDisplayMenuListView::Clear(void) {
for (int i=0; i<itemCount; i++) {
Lock();
if (menuItems[i]) {
delete menuItems[i];
menuItems[i] = NULL;
}
Unlock();
}
oneColumn = true;
for (int i=0; i<cSkinDisplayMenu::MaxTabs; i++) {

View File

@ -7,6 +7,7 @@
class cDisplayMenuListView {
private:
cMutex mutex;
cTemplateViewList *tmplList;
eMenuCategory cat;
string currentPlug;
@ -19,6 +20,8 @@ private:
public:
cDisplayMenuListView(cTemplateViewList *tmplList, int count, eMenuCategory cat = mcUnknown, string currentPlug = "");
virtual ~cDisplayMenuListView();
void Lock(void) { mutex.Lock(); };
void Unlock(void) { mutex.Unlock(); };
void Clear(void);
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
int GetMaxItems(void) { return itemCount; };

View File

@ -347,11 +347,15 @@ void cDisplayMenuRootView::KeyInput(bool up, bool page) {
void cDisplayMenuRootView::Clear(void) {
if (view) {
view->Lock();
view->ClearChannel();
view->ClearEpgSearchFavorite();
view->Unlock();
}
if (listView) {
listView->Lock();
listView->Clear();
listView->Unlock();
}
if (detailView) {
delete detailView;
@ -422,6 +426,7 @@ cFont *cDisplayMenuRootView::GetTextAreaFont(void) {
void cDisplayMenuRootView::Render(void) {
if (!view)
return;
view->Lock();
view->DrawDebugGrid();
if (!view->DrawBackground()) {
defaultBackgroundDrawn = true;
@ -453,6 +458,7 @@ void cDisplayMenuRootView::Render(void) {
view->DrawStaticViewElements();
view->DrawDynamicViewElements();
view->Unlock();
}
void cDisplayMenuRootView::RenderMenuItems(void) {

View File

@ -44,16 +44,20 @@ cView::~cView() {
cDevice::PrimaryDevice()->ScaleVideo(cRect::Null);
}
//clear detached views
Lock();
for (map<eViewElement,cViewElement*>::iterator dVeIt = detachedViewElements.begin(); dVeIt != detachedViewElements.end(); dVeIt++) {
cViewElement *ve = dVeIt->second;
delete ve;
}
Unlock();
//clear animations
Lock();
for (multimap<int, cAnimation*>::iterator animIt = animations.begin(); animIt != animations.end(); animIt++) {
cAnimation *anim = animIt->second;
anim->Stop();
delete anim;
}
Unlock();
//shift or fade out
if (fadeOut) {
if (IsAnimated())
@ -94,6 +98,8 @@ void cView::Action(void) {
DoFlush();
if (scrolling) {
DoSleep(scrollDelay);
if (!Running())
return;
if (scrollOrientation == orHorizontal) {
ActivateScrolling();
ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode);

View File

@ -14,6 +14,7 @@ class cViewElement;
class cView : public cPixmapContainer {
private:
cMutex mutex;
void Init(void);
void DoDrawDebugGrid(void);
void DoFill(int num, cTemplateFunction *func);
@ -76,8 +77,10 @@ public:
cView(cTemplateView *tmplView);
cView(cTemplateViewElement *tmplViewElement);
cView(cTemplateViewTab *tmplTab);
void DrawDebugGrid(void);
virtual ~cView();
void Lock(void) { mutex.Lock(); };
void Unlock(void) { mutex.Unlock(); };
void DrawDebugGrid(void);
virtual void Stop(void);
void HideAnimations(void);
void ShowAnimations(void);