From bc075507080607a79c688c5aef4e1c3d895747ac Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 20 Jun 2015 06:30:26 +0200 Subject: fixed crash using animated images in plugins --- HISTORY | 2 ++ libskindesignerapi/osdelements.c | 3 +++ views/displaypluginview.c | 2 ++ views/view.c | 14 ++++++++++++++ views/view.h | 2 ++ views/viewgrid.c | 2 ++ 6 files changed, 25 insertions(+) diff --git a/HISTORY b/HISTORY index 1153b01..60ace8b 100644 --- a/HISTORY +++ b/HISTORY @@ -375,3 +375,5 @@ Version 0.5.3 - added SVG Template parsing - fixed memory leak when creating fonts +- fixed crash using animated images in plugins + diff --git a/libskindesignerapi/osdelements.c b/libskindesignerapi/osdelements.c index 74524d7..105a409 100644 --- a/libskindesignerapi/osdelements.c +++ b/libskindesignerapi/osdelements.c @@ -78,6 +78,9 @@ skindesignerapi::cViewGrid::cViewGrid(skindesignerapi::ISkinDisplayPlugin *view, } skindesignerapi::cViewGrid::~cViewGrid() { + if (!view) + return; + view->ClearGrids(viewGridID); } void skindesignerapi::cViewGrid::SetGrid(long gridID, double x, double y, double width, double height) { diff --git a/views/displaypluginview.c b/views/displaypluginview.c index 95d9dc0..ba95d93 100644 --- a/views/displaypluginview.c +++ b/views/displaypluginview.c @@ -39,6 +39,7 @@ void cDisplayPluginView::Deactivate(bool hide) { cDevice::PrimaryDevice()->ScaleVideo(cRect::Null); } HidePixmaps(); + HideAnimations(); for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) { cViewGrid *viewGrid = it->second; viewGrid->Hide(); @@ -52,6 +53,7 @@ void cDisplayPluginView::Activate(void) { } if (hidden) { ShowPixmaps(); + ShowAnimations(); for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) { cViewGrid *viewGrid = it->second; viewGrid->Show(); diff --git a/views/view.c b/views/view.c index 31254bf..98fe38e 100644 --- a/views/view.c +++ b/views/view.c @@ -269,6 +269,20 @@ void cView::ClearAnimations(int cat) { animations.erase(cat); } +void cView::HideAnimations(void) { + for (multimap::iterator it = animations.begin(); it!=animations.end(); ++it) { + cAnimation *anim = it->second; + anim->HidePixmaps(); + } +} + +void cView::ShowAnimations(void) { + for (multimap::iterator it = animations.begin(); it!=animations.end(); ++it) { + cAnimation *anim = it->second; + anim->ShowPixmaps(); + } +} + void cView::ActivateScrolling(void) { if (veScroll == veUndefined) return; diff --git a/views/view.h b/views/view.h index 1dcaef9..ccdc14c 100644 --- a/views/view.h +++ b/views/view.h @@ -78,6 +78,8 @@ public: void DrawDebugGrid(void); virtual ~cView(); virtual void Stop(void); + void HideAnimations(void); + void ShowAnimations(void); }; class cViewElement : public cView { diff --git a/views/viewgrid.c b/views/viewgrid.c index 008133e..551fb9e 100644 --- a/views/viewgrid.c +++ b/views/viewgrid.c @@ -71,6 +71,7 @@ void cViewGrid::Hide(void) { for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) { cGrid *grid = it->second; grid->HidePixmaps(); + grid->HideAnimations(); } } @@ -78,6 +79,7 @@ void cViewGrid::Show(void) { for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) { cGrid *grid = it->second; grid->ShowPixmaps(); + grid->ShowAnimations(); } } -- cgit v1.2.3