discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrong assert in GSString.m


From: Roland Schwingel
Subject: Wrong assert in GSString.m
Date: Mon, 08 Mar 2010 11:41:10 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Hi...

There is IMHO a wrong assert in GSString's dealloc method.
The assert is wrongly triggered if the string is created using
-initWithContentsOfFile:@"/path/to/nonExistingFile"

The attached patch fixes this.

Thanks for applying,

Roland

--- GSString.m.orig     2010-03-03 12:05:32.000000000 +0100
+++ GSString.m  2010-03-08 10:49:47.000000000 +0100
@@ -3791,7 +3791,8 @@
 
 - (void) dealloc
 {
-NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
+  NSAssert((_flags.owned == 1 && _zone != 0) || 
+      (_contents.c == 0 && _zone == 0), NSInternalInconsistencyException);
   if (_contents.c != 0)
     {
       NSZoneFree(self->_zone, self->_contents.c);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]