[vdr] cString operator= with same buffer
Sascha Volkenandt
lists at magoa.net
Sat Nov 19 20:59:06 CET 2005
On Friday 18 November 2005 19:48, Holger Brunn wrote:
> I'm wondering what should happen when assigning a cString to another where
> both have pointers to the same buffer? As of version 1.3.36, we first free
> it and duplicate it afterwards.
Why would you want this, or better why should two cStrings point to the same
buffer?
From what I can see, cBuffer was intended to be constructed with TakePointer =
false, in that case the string is duped anyway, or with true in which case
you handed over the buffer to cString and shouldn't use it further.
Anyway, if those two strings that point to the same buffer are destroyed, the
buffer becomes free'd twice, which is certainly illegal as well :-)
Greetings,
Sascha
More information about the vdr
mailing list