[Issue 5802] Pointer becoming invalid

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 30 22:30:41 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5802


Brad Roberts <braddr at puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |braddr at puremagic.com


--- Comment #1 from Brad Roberts <braddr at puremagic.com> 2011-03-30 22:27:12 PDT ---
I haven't looked at this under a debugger, but what I suspect is happening is
this:

In csvText, you're creating a temporary RecordList which is copied on return if
NRVO isn't happening.  The pointer inside recordRange points to the temporary. 
After the copy, the temporary goes away and the pointer is invalid.

Test this by printing the address of RecordList._input inside the RecordList
ctor and again in RecordRange.front.  If I'm right, the two addresses will
differ and the pointer value inside recordRange._input will be the first value.

Assuming all of the above is right, the fix is to add a postblit to fix up the
pointer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list