diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2021-04-08 13:04:55 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2021-04-11 12:49:13 +0200 |
commit | 719b32f1986c9dfbb878828549176fe737cd41e0 (patch) | |
tree | 7934130f0f3a7fdd3b90ec27de6efa5014aba586 | |
parent | c54f7ba74ff8f1a363142c68bf215ee42c965ac9 (diff) | |
download | skin-nopacity-719b32f1986c9dfbb878828549176fe737cd41e0.tar.gz skin-nopacity-719b32f1986c9dfbb878828549176fe737cd41e0.tar.bz2 |
Fix segfault in cNopacitySetup::~cNopacitySetup()
A segfault occurred when nOpacity is not the active skin and the
plugin's setup page was exited.
-rw-r--r-- | nopacity.c | 2 | ||||
-rw-r--r-- | setup.c | 17 |
2 files changed, 13 insertions, 6 deletions
@@ -58,7 +58,7 @@ cSkinDisplayMessage *cNopacity::DisplayMessage(void) { } void cNopacity::ReloadCaches(void) { - if (geoManager->SetOSDSize() || imgCache->ThemeChanged()) { + if (geoManager->SetOSDSize() || !imgCache || imgCache->ThemeChanged()) { int start = cTimeMs::Now(); config.Init(); geoManager->SetGeometry(); @@ -1,3 +1,4 @@ +#include <vdr/skins.h> #include "setup.h" cNopacitySetup::cNopacitySetup(void) { @@ -8,14 +9,20 @@ cNopacitySetup::cNopacitySetup(void) { } cNopacitySetup::~cNopacitySetup(void) { - int start = cTimeMs::Now(); config.SetFontName(); - geoManager->SetGeometry(); delete fontManager; - fontManager = new cFontManager(); delete imgCache; - imgCache = new cImageCache(); - dsyslog("nopacity: Cache reloaded in %d ms", int(cTimeMs::Now()-start)); + cSkin *Skin = Skins.Get(Skins.Current()->Index()); + if (strcmp(Skin->Name(), "nOpacity") == 0) { + int start = cTimeMs::Now(); + geoManager->SetGeometry(); + fontManager = new cFontManager(); + imgCache = new cImageCache(); + dsyslog("nopacity: Cache reloaded in %d ms", int(cTimeMs::Now() - start)); + } else { + fontManager = NULL; + imgCache = NULL; + } } |