summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-04-08 13:04:55 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-04-11 12:49:13 +0200
commit719b32f1986c9dfbb878828549176fe737cd41e0 (patch)
tree7934130f0f3a7fdd3b90ec27de6efa5014aba586
parentc54f7ba74ff8f1a363142c68bf215ee42c965ac9 (diff)
downloadskin-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.c2
-rw-r--r--setup.c17
2 files changed, 13 insertions, 6 deletions
diff --git a/nopacity.c b/nopacity.c
index 3ca77d9..76c8ed0 100644
--- a/nopacity.c
+++ b/nopacity.c
@@ -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();
diff --git a/setup.c b/setup.c
index a9135fb..6f749b8 100644
--- a/setup.c
+++ b/setup.c
@@ -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;
+ }
}