fixed crash using animated images in plugins

This commit is contained in:
louis 2015-06-20 06:30:26 +02:00
parent a0a6e21d5a
commit bc07550708
6 changed files with 25 additions and 0 deletions

View File

@ -375,3 +375,5 @@ Version 0.5.3
- added SVG Template parsing - added SVG Template parsing
- fixed memory leak when creating fonts - fixed memory leak when creating fonts
- fixed crash using animated images in plugins

View File

@ -78,6 +78,9 @@ skindesignerapi::cViewGrid::cViewGrid(skindesignerapi::ISkinDisplayPlugin *view,
} }
skindesignerapi::cViewGrid::~cViewGrid() { skindesignerapi::cViewGrid::~cViewGrid() {
if (!view)
return;
view->ClearGrids(viewGridID);
} }
void skindesignerapi::cViewGrid::SetGrid(long gridID, double x, double y, double width, double height) { void skindesignerapi::cViewGrid::SetGrid(long gridID, double x, double y, double width, double height) {

View File

@ -39,6 +39,7 @@ void cDisplayPluginView::Deactivate(bool hide) {
cDevice::PrimaryDevice()->ScaleVideo(cRect::Null); cDevice::PrimaryDevice()->ScaleVideo(cRect::Null);
} }
HidePixmaps(); HidePixmaps();
HideAnimations();
for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) { for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
cViewGrid *viewGrid = it->second; cViewGrid *viewGrid = it->second;
viewGrid->Hide(); viewGrid->Hide();
@ -52,6 +53,7 @@ void cDisplayPluginView::Activate(void) {
} }
if (hidden) { if (hidden) {
ShowPixmaps(); ShowPixmaps();
ShowAnimations();
for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) { for (map< int, cViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
cViewGrid *viewGrid = it->second; cViewGrid *viewGrid = it->second;
viewGrid->Show(); viewGrid->Show();

View File

@ -269,6 +269,20 @@ void cView::ClearAnimations(int cat) {
animations.erase(cat); animations.erase(cat);
} }
void cView::HideAnimations(void) {
for (multimap<int,cAnimation*>::iterator it = animations.begin(); it!=animations.end(); ++it) {
cAnimation *anim = it->second;
anim->HidePixmaps();
}
}
void cView::ShowAnimations(void) {
for (multimap<int,cAnimation*>::iterator it = animations.begin(); it!=animations.end(); ++it) {
cAnimation *anim = it->second;
anim->ShowPixmaps();
}
}
void cView::ActivateScrolling(void) { void cView::ActivateScrolling(void) {
if (veScroll == veUndefined) if (veScroll == veUndefined)
return; return;

View File

@ -78,6 +78,8 @@ public:
void DrawDebugGrid(void); void DrawDebugGrid(void);
virtual ~cView(); virtual ~cView();
virtual void Stop(void); virtual void Stop(void);
void HideAnimations(void);
void ShowAnimations(void);
}; };
class cViewElement : public cView { class cViewElement : public cView {

View File

@ -71,6 +71,7 @@ void cViewGrid::Hide(void) {
for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) { for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) {
cGrid *grid = it->second; cGrid *grid = it->second;
grid->HidePixmaps(); grid->HidePixmaps();
grid->HideAnimations();
} }
} }
@ -78,6 +79,7 @@ void cViewGrid::Show(void) {
for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) { for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) {
cGrid *grid = it->second; cGrid *grid = it->second;
grid->ShowPixmaps(); grid->ShowPixmaps();
grid->ShowAnimations();
} }
} }