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 - changed skinrepository from static file to github repository
- fixed flickering when main menu is fading - fixed flickering when main menu is fading
- some changes in metrixHD - 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) { void cDisplayMenuItemView::Action(void) {
if (scrolling) { if (scrolling) {
DoSleep(scrollDelay); DoSleep(scrollDelay);
if (!Running())
return;
PrepareScrolling(); PrepareScrolling();
if (scrollOrientation == orHorizontal) { if (scrollOrientation == orHorizontal) {
ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode);

View File

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

View File

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

View File

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

View File

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

View File

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