From 8da9f0f034940a3ff3b0256c956a5ce925c192cd Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 15 Feb 2021 19:34:34 +0100 Subject: move thread cancel in new introduced Stop() function (hint by VDR maintainer) --- HISTORY | 2 ++ display.c | 7 +++++-- display.h | 1 + plugin.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 364abc4..0592847 100644 --- a/HISTORY +++ b/HISTORY @@ -1,5 +1,7 @@ VDR Plugin 'graphlcd' Revision History ------------------------------------- +2021-02-15: Version 1.0.5 +- [pbiering] move thread cancel in new introduced Stop() function (hint by VDR maintainer) 2021-02-08: Version 1.0.4 - [pbiering] add support for new feature: NumRecordings and ListRecordings diff --git a/display.c b/display.c index 0158366..7806f80 100644 --- a/display.c +++ b/display.c @@ -60,8 +60,6 @@ cGraphLCDDisplay::cGraphLCDDisplay() cGraphLCDDisplay::~cGraphLCDDisplay() { - Cancel(3); - delete mSkin; delete mSkinConfig; delete mScreen; @@ -70,6 +68,11 @@ cGraphLCDDisplay::~cGraphLCDDisplay() delete mService; } +void cGraphLCDDisplay::Stop (void) +{ + Cancel(3); +} + bool cGraphLCDDisplay::Initialise(GLCD::cDriver * Lcd, const std::string & CfgPath, const std::string & SkinsPath, const std::string & SkinName) { std::string skinsPath; diff --git a/display.h b/display.h index 2bb971a..cd4182e 100644 --- a/display.h +++ b/display.h @@ -56,6 +56,7 @@ public: ~cGraphLCDDisplay(void); bool Initialise(GLCD::cDriver * Lcd, const std::string & CfgPath, const std::string & SkinsPath, const std::string & SkinName); + void Stop(void); void Tick(); void Update(); void Clear(); diff --git a/plugin.c b/plugin.c index 65a59f8..517c23b 100644 --- a/plugin.c +++ b/plugin.c @@ -39,7 +39,7 @@ static const char * kPluginName = "graphlcd"; -static const char *VERSION = "1.0.4"; +static const char *VERSION = "1.0.5"; static const char *DESCRIPTION = trNOOP("Output to graphic LCD"); static const char *MAINMENUENTRY = NULL; -- cgit v1.2.3 From 603ac03d8ff62fb29bd8e57e2c6927c791c78866 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 15 Feb 2021 20:13:20 +0100 Subject: change value to be able to detect in core dump --- display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display.c b/display.c index 7806f80..c1a5205 100644 --- a/display.c +++ b/display.c @@ -398,7 +398,7 @@ void cGraphLCDDisplay::Action(void) } } #endif - cCondWait::SleepMs(100); + cCondWait::SleepMs(101); // TODO: causes crash on stop } } else -- cgit v1.2.3 From 97b63a6f883300254372c18a60b9efba25189d06 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Mon, 15 Feb 2021 21:14:06 +0100 Subject: fix to proper Stop(), add some debug log and rename thread matching plugin name --- display.c | 9 +++------ plugin.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/display.c b/display.c index c1a5205..c6eabb4 100644 --- a/display.c +++ b/display.c @@ -31,7 +31,7 @@ #include cGraphLCDDisplay::cGraphLCDDisplay() -: cThread("glcd_display"), +: cThread("graphlcd_display"), mLcd(NULL), mScreen(NULL), mSkin(NULL), @@ -60,6 +60,8 @@ cGraphLCDDisplay::cGraphLCDDisplay() cGraphLCDDisplay::~cGraphLCDDisplay() { + Cancel(3); + delete mSkin; delete mSkinConfig; delete mScreen; @@ -68,11 +70,6 @@ cGraphLCDDisplay::~cGraphLCDDisplay() delete mService; } -void cGraphLCDDisplay::Stop (void) -{ - Cancel(3); -} - bool cGraphLCDDisplay::Initialise(GLCD::cDriver * Lcd, const std::string & CfgPath, const std::string & SkinsPath, const std::string & SkinName) { std::string skinsPath; diff --git a/plugin.c b/plugin.c index 517c23b..1d8cd1e 100644 --- a/plugin.c +++ b/plugin.c @@ -93,6 +93,7 @@ public: virtual bool ProcessArgs(int argc, char * argv[]); virtual bool Initialize(); virtual bool Start(); + virtual void Stop(void); virtual void Housekeeping(); virtual const char **SVDRPHelpPages(void); virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); @@ -120,12 +121,18 @@ cPluginGraphLCD::cPluginGraphLCD() cPluginGraphLCD::~cPluginGraphLCD() { - for (unsigned int index = 0; index < GRAPHLCD_MAX_DISPLAYS; index++) - DisconnectDisplay(index); mExtData->ReleaseExtData(); mExtData = NULL; } +void cPluginGraphLCD::Stop(void) +{ + for (unsigned int index = 0; index < GRAPHLCD_MAX_DISPLAYS; index++) { + dsyslog("graphlcd plugin: DisconnectDisplay %d", index); + DisconnectDisplay(index); + }; +} + const char * cPluginGraphLCD::CommandLineHelp() { return " -c, --config=CFG use CFG as driver config file (default is \"" PLUGIN_GRAPHLCDCONF "\")\n" -- cgit v1.2.3 From 68d74dabd233f91e4d80222d1ed547b9ae00f62f Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 16 Feb 2021 06:35:11 +0100 Subject: move cleanup also into Stop() to avoid crash --- plugin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin.c b/plugin.c index 1d8cd1e..97a8609 100644 --- a/plugin.c +++ b/plugin.c @@ -121,8 +121,6 @@ cPluginGraphLCD::cPluginGraphLCD() cPluginGraphLCD::~cPluginGraphLCD() { - mExtData->ReleaseExtData(); - mExtData = NULL; } void cPluginGraphLCD::Stop(void) @@ -131,6 +129,9 @@ void cPluginGraphLCD::Stop(void) dsyslog("graphlcd plugin: DisconnectDisplay %d", index); DisconnectDisplay(index); }; + + mExtData->ReleaseExtData(); + mExtData = NULL; } const char * cPluginGraphLCD::CommandLineHelp() -- cgit v1.2.3 From 56d10fbb9a8adba102df4cbb96aee4e2248a7daa Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 16 Feb 2021 07:48:22 +0100 Subject: remove TODO --- display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display.c b/display.c index c6eabb4..ed35b9e 100644 --- a/display.c +++ b/display.c @@ -395,7 +395,7 @@ void cGraphLCDDisplay::Action(void) } } #endif - cCondWait::SleepMs(101); // TODO: causes crash on stop + cCondWait::SleepMs(101); } } else -- cgit v1.2.3 From 56960c9091aeb1c1adce2aa7394291d9a1b51e6a Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 16 Feb 2021 07:50:06 +0100 Subject: revert to original --- display.c | 2 +- display.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/display.c b/display.c index ed35b9e..aa16244 100644 --- a/display.c +++ b/display.c @@ -395,7 +395,7 @@ void cGraphLCDDisplay::Action(void) } } #endif - cCondWait::SleepMs(101); + cCondWait::SleepMs(100); } } else diff --git a/display.h b/display.h index cd4182e..2bb971a 100644 --- a/display.h +++ b/display.h @@ -56,7 +56,6 @@ public: ~cGraphLCDDisplay(void); bool Initialise(GLCD::cDriver * Lcd, const std::string & CfgPath, const std::string & SkinsPath, const std::string & SkinName); - void Stop(void); void Tick(); void Update(); void Clear(); -- cgit v1.2.3