| | | | Browse by category |
Article ID: 803
Last updated: 05 Feb, 2008
Problem
When building a Tools.h++ library compiled with RWDEBUG defined, the following test case will produce a segmentation fault at run time:
Cause
An optimization in the copy-on-write mechanism that prevents empty strings from being copied causes this error.
Action
This error can be fixed by modifying the assertions in the file cstring.cpp in the method RWCString::clone (both clone() and clone(size_t)).
When building a Tools.h++ library compiled with RWDEBUG defined, the following test case will produce a segmentation fault at run time:
main() {Result: Segmentation fault core dump.
RWCString s;
s.toLower();
return 0; }
Cause
An optimization in the copy-on-write mechanism that prevents empty strings from being copied causes this error.
Action
This error can be fixed by modifying the assertions in the file cstring.cpp in the method RWCString::clone (both clone() and clone(size_t)).
RWPOSTCONDITION(pref()->references() == 1);becomes
RWPOSTCONDITION(pref()->references() == 1 || temp == nullStringRef);The same problem appears in the RWWString class. The same fix applies here.
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 803
Last updated: 05 Feb, 2008
Revision: 1
Views: 3463
Posted: 25 Jun, 1997 by
Dean J.
Updated: 05 Feb, 2008 by
Dean J.
Others in this category
Powered by KBPublisher (Knowledge base software)