Fixed cTimer::operator=() in case a cTimer variable is assigned to itself; implemented a copy constructor for cTimer

This commit is contained in:
Klaus Schmidinger 2006-09-08 15:06:09 +02:00
parent 5ff1d35711
commit 782f2683d9
5 changed files with 44 additions and 24 deletions

View File

@ -1465,6 +1465,7 @@ Udo Richter <udo_richter@gmx.de>
for fixing getting the next active timer when shutting down for fixing getting the next active timer when shutting down
for reporting a problem with cPlugin::ConfigDirectory() in case a plugin calls it for reporting a problem with cPlugin::ConfigDirectory() in case a plugin calls it
from a separate thread from a separate thread
for reporting that an assignment in svdrp.c didn't use the cTimer::operator=())
Sven Kreiensen <svenk@kammer.uni-hannover.de> Sven Kreiensen <svenk@kammer.uni-hannover.de>
for his help in keeping 'channels.conf.terr' up to date for his help in keeping 'channels.conf.terr' up to date
@ -1741,6 +1742,7 @@ Alexander Rieger <Alexander.Rieger@inka.de>
message clears all messages that have been previously queued by that thread message clears all messages that have been previously queued by that thread
for reporting that the cTimer::operator=() messes up the cListObject's pointers for reporting that the cTimer::operator=() messes up the cListObject's pointers
for reporting a memory leak in the cTimer::operator=() when using the 'aux' string for reporting a memory leak in the cTimer::operator=() when using the 'aux' string
for fixing cTimer::operator=() in case a cTimer variable is assigned to itself
Philip Prindeville <philipp_subx@redfish-solutions.com> Philip Prindeville <philipp_subx@redfish-solutions.com>
for updates to 'sources.conf' for updates to 'sources.conf'

View File

@ -4907,3 +4907,10 @@ Video Disk Recorder Revision History
Martin Ostermann). Martin Ostermann).
- Fixed handling relative volume settings that unmute the audio in the call to - Fixed handling relative volume settings that unmute the audio in the call to
cStatus::MsgSetVolume() (reported by Oliver Endriss). cStatus::MsgSetVolume() (reported by Oliver Endriss).
2006-09-04: Version 1.4.2-2
- Fixed cTimer::operator=() in case a cTimer variable is assigned to itself (thanks
to Alexander Rieger).
- Implemented a copy constructor for cTimer (thanks to Udo Richter for reporting that
an assignment in svdrp.c didn't use the cTimer::operator=()).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: config.h 1.268 2006/09/01 12:59:35 kls Exp $ * $Id: config.h 1.269 2006/09/04 17:44:12 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -21,13 +21,13 @@
// VDR's own version number: // VDR's own version number:
#define VDRVERSION "1.4.2-1" #define VDRVERSION "1.4.2-2"
#define VDRVERSNUM 10402 // Version * 10000 + Major * 100 + Minor #define VDRVERSNUM 10402 // Version * 10000 + Major * 100 + Minor
// The plugin API's version number: // The plugin API's version number:
#define APIVERSION "1.4.2" #define APIVERSION "1.4.3"
#define APIVERSNUM 10402 // Version * 10000 + Major * 100 + Minor #define APIVERSNUM 10403 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which // When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to // may be smaller than VDRVERSION in case there have been no changes to

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: timers.c 1.63 2006/09/02 10:20:36 kls Exp $ * $Id: timers.c 1.64 2006/09/08 15:06:09 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -83,6 +83,14 @@ cTimer::cTimer(const cEvent *Event)
event = NULL; // let SetEvent() be called to get a log message event = NULL; // let SetEvent() be called to get a log message
} }
cTimer::cTimer(const cTimer &Timer)
{
channel = NULL;
aux = NULL;
event = NULL;
*this = Timer;
}
cTimer::~cTimer() cTimer::~cTimer()
{ {
free(aux); free(aux);
@ -90,24 +98,26 @@ cTimer::~cTimer()
cTimer& cTimer::operator= (const cTimer &Timer) cTimer& cTimer::operator= (const cTimer &Timer)
{ {
startTime = Timer.startTime; if (&Timer != this) {
stopTime = Timer.stopTime; startTime = Timer.startTime;
lastSetEvent = 0; stopTime = Timer.stopTime;
recording = Timer.recording; lastSetEvent = 0;
pending = Timer.pending; recording = Timer.recording;
inVpsMargin = Timer.inVpsMargin; pending = Timer.pending;
flags = Timer.flags; inVpsMargin = Timer.inVpsMargin;
channel = Timer.channel; flags = Timer.flags;
day = Timer.day; channel = Timer.channel;
weekdays = Timer.weekdays; day = Timer.day;
start = Timer.start; weekdays = Timer.weekdays;
stop = Timer.stop; start = Timer.start;
priority = Timer.priority; stop = Timer.stop;
lifetime = Timer.lifetime; priority = Timer.priority;
strncpy(file, Timer.file, sizeof(file)); lifetime = Timer.lifetime;
free(aux); strncpy(file, Timer.file, sizeof(file));
aux = Timer.aux ? strdup(Timer.aux) : NULL; free(aux);
event = NULL; aux = Timer.aux ? strdup(Timer.aux) : NULL;
event = NULL;
}
return *this; return *this;
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: timers.h 1.28 2006/04/08 12:41:44 kls Exp $ * $Id: timers.h 1.29 2006/09/04 17:07:39 kls Exp $
*/ */
#ifndef __TIMERS_H #ifndef __TIMERS_H
@ -44,6 +44,7 @@ private:
public: public:
cTimer(bool Instant = false, bool Pause = false, cChannel *Channel = NULL); cTimer(bool Instant = false, bool Pause = false, cChannel *Channel = NULL);
cTimer(const cEvent *Event); cTimer(const cEvent *Event);
cTimer(const cTimer &Timer);
virtual ~cTimer(); virtual ~cTimer();
cTimer& operator= (const cTimer &Timer); cTimer& operator= (const cTimer &Timer);
virtual int Compare(const cListObject &ListObject) const; virtual int Compare(const cListObject &ListObject) const;