mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed missing cleanup at program exit in case there is a problem with a plugin
This commit is contained in:
parent
5105187701
commit
f7dd342f52
@ -1115,3 +1115,7 @@ Stefan Meyknecht <stefan@meyknecht.org>
|
|||||||
Lucian Muresan <lucianm@users.sourceforge.net>
|
Lucian Muresan <lucianm@users.sourceforge.net>
|
||||||
for updating the Romanian language texts and the iso8859-2 fonts
|
for updating the Romanian language texts and the iso8859-2 fonts
|
||||||
for making VDR actually use the iso8859-15 fonts
|
for making VDR actually use the iso8859-15 fonts
|
||||||
|
|
||||||
|
Mattias Grönlund <Mattias@Gronlund.net>
|
||||||
|
for pointing out a missing cleanup at program exit in case there is a problem
|
||||||
|
with a plugin
|
||||||
|
2
HISTORY
2
HISTORY
@ -3057,3 +3057,5 @@ Video Disk Recorder Revision History
|
|||||||
- Updated Romanian language texts and the iso8859-2 fonts (thanks to Lucian Muresan).
|
- Updated Romanian language texts and the iso8859-2 fonts (thanks to Lucian Muresan).
|
||||||
- Now actually using the iso8859-15 fonts (thanks to Lucian Muresan).
|
- Now actually using the iso8859-15 fonts (thanks to Lucian Muresan).
|
||||||
- Some minor code cleanups (thanks to Prakash K. Cheemplavam).
|
- Some minor code cleanups (thanks to Prakash K. Cheemplavam).
|
||||||
|
- Fixed missing cleanup at program exit in case there is a problem with a plugin
|
||||||
|
(thanks to Mattias Grönlund for pointing this out).
|
||||||
|
46
vdr.c
46
vdr.c
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
* The project's page is at http://www.cadsoft.de/vdr
|
* The project's page is at http://www.cadsoft.de/vdr
|
||||||
*
|
*
|
||||||
* $Id: vdr.c 1.188 2004/10/23 12:40:24 kls Exp $
|
* $Id: vdr.c 1.189 2004/10/23 15:04:52 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -64,6 +64,8 @@
|
|||||||
#define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start
|
#define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start
|
||||||
#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications
|
#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications
|
||||||
|
|
||||||
|
#define EXIT(v) { ExitCode = (v); goto Exit; }
|
||||||
|
|
||||||
static int Interrupted = 0;
|
static int Interrupted = 0;
|
||||||
|
|
||||||
static void SignalHandler(int signum)
|
static void SignalHandler(int signum)
|
||||||
@ -122,6 +124,7 @@ int main(int argc, char *argv[])
|
|||||||
const char *Terminal = NULL;
|
const char *Terminal = NULL;
|
||||||
const char *Shutdown = NULL;
|
const char *Shutdown = NULL;
|
||||||
cPluginManager PluginManager(DEFAULTPLUGINDIR);
|
cPluginManager PluginManager(DEFAULTPLUGINDIR);
|
||||||
|
int ExitCode = 0;
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{ "audio", required_argument, NULL, 'a' },
|
{ "audio", required_argument, NULL, 'a' },
|
||||||
@ -347,7 +350,7 @@ int main(int argc, char *argv[])
|
|||||||
// Load plugins:
|
// Load plugins:
|
||||||
|
|
||||||
if (!PluginManager.LoadPlugins(true))
|
if (!PluginManager.LoadPlugins(true))
|
||||||
return 2;
|
EXIT(2);
|
||||||
|
|
||||||
// Configuration data:
|
// Configuration data:
|
||||||
|
|
||||||
@ -369,7 +372,7 @@ int main(int argc, char *argv[])
|
|||||||
Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) &&
|
Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) &&
|
||||||
KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true)
|
KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true)
|
||||||
))
|
))
|
||||||
return 2;
|
EXIT(2);
|
||||||
|
|
||||||
cFont::SetCode(I18nCharSets()[Setup.OSDLanguage]);
|
cFont::SetCode(I18nCharSets()[Setup.OSDLanguage]);
|
||||||
|
|
||||||
@ -391,7 +394,7 @@ int main(int argc, char *argv[])
|
|||||||
// Initialize plugins:
|
// Initialize plugins:
|
||||||
|
|
||||||
if (!PluginManager.InitializePlugins())
|
if (!PluginManager.InitializePlugins())
|
||||||
return 2;
|
EXIT(2);
|
||||||
|
|
||||||
// Primary device:
|
// Primary device:
|
||||||
|
|
||||||
@ -414,12 +417,12 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "vdr: %s\n", msg);
|
fprintf(stderr, "vdr: %s\n", msg);
|
||||||
esyslog("ERROR: %s", msg);
|
esyslog("ERROR: %s", msg);
|
||||||
if (!cDevice::SetPrimaryDevice(1))
|
if (!cDevice::SetPrimaryDevice(1))
|
||||||
return 2;
|
EXIT(2);
|
||||||
if (!cDevice::PrimaryDevice()) {
|
if (!cDevice::PrimaryDevice()) {
|
||||||
const char *msg = "no primary device found - giving up!";
|
const char *msg = "no primary device found - giving up!";
|
||||||
fprintf(stderr, "vdr: %s\n", msg);
|
fprintf(stderr, "vdr: %s\n", msg);
|
||||||
esyslog("ERROR: %s", msg);
|
esyslog("ERROR: %s", msg);
|
||||||
return 2;
|
EXIT(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -431,7 +434,7 @@ int main(int argc, char *argv[])
|
|||||||
// Start plugins:
|
// Start plugins:
|
||||||
|
|
||||||
if (!PluginManager.StartPlugins())
|
if (!PluginManager.StartPlugins())
|
||||||
return 2;
|
EXIT(2);
|
||||||
|
|
||||||
// Skins:
|
// Skins:
|
||||||
|
|
||||||
@ -487,18 +490,18 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Main program loop:
|
// Main program loop:
|
||||||
|
|
||||||
cOsdObject *Menu = NULL;
|
static cOsdObject *Menu = NULL;
|
||||||
cOsdObject *Temp = NULL;
|
static cOsdObject *Temp = NULL;
|
||||||
int LastChannel = -1;
|
static int LastChannel = -1;
|
||||||
int LastTimerChannel = -1;
|
static int LastTimerChannel = -1;
|
||||||
int PreviousChannel[2] = { 1, 1 };
|
static int PreviousChannel[2] = { 1, 1 };
|
||||||
int PreviousChannelIndex = 0;
|
static int PreviousChannelIndex = 0;
|
||||||
time_t LastChannelChanged = time(NULL);
|
static time_t LastChannelChanged = time(NULL);
|
||||||
time_t LastActivity = 0;
|
static time_t LastActivity = 0;
|
||||||
int MaxLatencyTime = 0;
|
static int MaxLatencyTime = 0;
|
||||||
bool ForceShutdown = false;
|
static bool ForceShutdown = false;
|
||||||
bool UserShutdown = false;
|
static bool UserShutdown = false;
|
||||||
bool TimerInVpsMargin = false;
|
static bool TimerInVpsMargin = false;
|
||||||
|
|
||||||
while (!Interrupted) {
|
while (!Interrupted) {
|
||||||
// Handle emergency exits:
|
// Handle emergency exits:
|
||||||
@ -887,6 +890,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (Interrupted)
|
if (Interrupted)
|
||||||
isyslog("caught signal %d", Interrupted);
|
isyslog("caught signal %d", Interrupted);
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
|
||||||
cRecordControls::Shutdown();
|
cRecordControls::Shutdown();
|
||||||
cCutter::Stop();
|
cCutter::Stop();
|
||||||
delete Menu;
|
delete Menu;
|
||||||
@ -913,5 +919,5 @@ int main(int argc, char *argv[])
|
|||||||
esyslog("emergency exit!");
|
esyslog("emergency exit!");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return ExitCode;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user