bug-gnustep
[Top][All Lists]
Advanced

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

Misc. bugs in GSXML, NSTextView, XIM, SSL


From: Alexander Malmberg
Subject: Misc. bugs in GSXML, NSTextView, XIM, SSL
Date: Sat, 04 May 2002 02:20:07 +0200

Hi,

[GSXMLParser -parse] calls [self _parseChunk: nil] to finish parsing, so
I assume _parseChunk: is supposed to pass a 1 for terminate to libxml in
that case (last parameter), but it didn't do that. I've attached a
patch.

Releasing an NSTextView will still sometimes cause a crash. It seems
that something in the text network is being retained by an
autoreleasepool (not sure why), but [NSTextView -dealloc] expects to be
released during the RELEASE(_textStorage). I've attached a patch that
causes it to just return from first -dealloc and do the real deallocing
when it's released again.

back/Source/x11/XIMInputServer.m was still using #if instead of #ifdef.

- Alexander Malmberg
Index: base/Source/Additions/GSXML.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/Additions/GSXML.m,v
retrieving revision 1.8
diff -u -r1.8 GSXML.m
--- base/Source/Additions/GSXML.m       12 Apr 2002 11:37:00 -0000      1.8
+++ base/Source/Additions/GSXML.m       3 May 2002 23:49:27 -0000
@@ -2092,7 +2092,7 @@
 - (void) _parseChunk: (NSData*)data
 {
   // nil data allowed
-  xmlParseChunk(lib, [data bytes], [data length], 0);
+  xmlParseChunk(lib, [data bytes], [data length], data==nil);
 }
 
 @end
@@ -2127,7 +2127,7 @@
 
 - (void) _parseChunk: (NSData*)data
 {
-  htmlParseChunk(lib, [data bytes], [data length], 0);
+  htmlParseChunk(lib, [data bytes], [data length], data==nil);
 }
 
 @end
Index: gui/Source/NSTextView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSTextView.m,v
retrieving revision 1.94
diff -u -r1.94 NSTextView.m
--- gui/Source/NSTextView.m     11 Apr 2002 23:17:42 -0000      1.94
+++ gui/Source/NSTextView.m     4 May 2002 00:08:04 -0000
@@ -300,21 +300,20 @@
 
 - (void)dealloc
 {
-  if (_tvf.owns_text_network == YES)
+  if (_tvf.owns_text_network)
     {
-      /* Prevent recursive dealloc */
-      if (_tvf.is_in_dealloc == YES)
+      /* If we own the text network we need to fix the retain chain. We do
+      this by retaining ourself and releasing _textStorage (using DESTROY
+      so it is set to nil before it is released). When the rest of the text
+      network is released (probably during the DESTROY, but later if parts
+      of it are retained elsewhere), we'll be released again and be dealloced
+      for real. */
+      if (_textStorage)
        {
+         RETAIN (self);
+         DESTROY (_textStorage);
          return;
        }
-      _tvf.is_in_dealloc = YES;
-      /* Balance the RELEASE we sent to us to break the retain cycle
-        in initWithFrame: or initWithCoder: (otherwise releasing the
-        _textStorage will make our retain count go below zero ;-) */
-      RETAIN (self);
-
-      /* This releases all the text objects (us included) in fall */
-      RELEASE (_textStorage);
     }
 
   if (_insertionPointTimer != nil)
Index: back/Source/x11/XIMInputServer.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/back/Source/x11/XIMInputServer.m,v
retrieving revision 1.2
diff -u -r1.2 XIMInputServer.m
--- back/Source/x11/XIMInputServer.m    16 Apr 2002 03:47:03 -0000      1.2
+++ back/Source/x11/XIMInputServer.m    3 May 2002 23:49:26 -0000
@@ -95,7 +95,7 @@
       encoding = [NSString defaultCStringEncoding];
     }
 
-#if USE_XIM
+#ifdef USE_XIM
   if ([self ximInit: dpy] == NO)
     {
       NSLog(@"Unable to initialize XIM, using standard keyboard events");
@@ -289,7 +289,7 @@
     return;
 
   /* Make sure we have an ic for this window */
-#if USE_XIM
+#ifdef USE_XIM
   if (windev->ic == NULL)
     {
       windev->ic = [self ximCreateIC: windev->ident];

reply via email to

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