Home » U++ Library support » U++ Library : Other (not classified elsewhere) » WString0::Free() crashing
WString0::Free() crashing [message #40668] |
Thu, 29 August 2013 22:32 |
crydev
Messages: 151 Registered: October 2012 Location: Netherlands
|
Experienced Member |
|
|
Hello,
I am experiencing a crash that I cannot identify. When assigning a new wchar buffer to a WString class, I sometimes experience erors. Sometimes this does not occur, but sometimes it does. The crash it at:
inline int AtomicDec(volatile Atomic& t) { return InterlockedDecrement((Atomic *)&t); }
The calling code is:
WString* localValues; // just to show what type the array is, this is fully initialized so no problems here.
const wchar* strPtr = (const wchar*)&(buffer[i]);
localValues[arrayIndex++] = WString(strPtr, value.GetLength()); // value.GetLength() is the length of the string, say 5.
The usual String class does not produce errors, while the assignment method is exactly the same. Why does it crash? I am using Win32 ofcourse.
Thanks, crydev
[Updated on: Thu, 29 August 2013 22:33] Report message to a moderator
|
|
|
|
Re: WString0::Free() crashing [message #40677 is a reply to message #40669] |
Fri, 30 August 2013 22:21 |
crydev
Messages: 151 Registered: October 2012 Location: Netherlands
|
Experienced Member |
|
|
I fixed it by changing the array to a Vector<WString> and using Vector.SetCount to gradually increase alloc to keep the size equal to my other arrays.
Thanks for the pointers!
|
|
|
Goto Forum:
Current Time: Fri Mar 29 11:45:27 CET 2024
Total time taken to generate the page: 0.01185 seconds
|