Re: [Deinterlace-discuss] Bugs in scheduling code
Brought to you by:
adcockj,
dschmelzer
|
From: Rob M. <rob...@gm...> - 2007-03-01 16:02:33
|
At 08:28 01-03-07, John Adcock wrote:
> > Code from the new patch:
> > ------------------------------------
> > char* CSchedule::getTimeStr() const
> > {
> > static char chTime[6];
> > strcpy(chTime,m_time_start.Format("%H:%M").GetBuffer());
> > return chTime;
> > }
> > ------------------------------------
>Function signiture really should be
>
>const char* CSchedule::getTimeStr() const
>
>But basically this looks fine to me.
What do I miss here then?
There is only one variable chTime shared among all instances of
CSchedule, right?
In that case when you store a pointer to the value returned by
getTimeStr() it is only a matter of time before the contents of the
string change. The first call to getTimeStr() by another instance of
CSchedule will change the contents of the string. A race condition exists.
Please correct me if I am wrong.
Rob
|