gnustep-dev
[Top][All Lists]
Advanced

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

Re: Unresolved Issues with libxml2


From: Ivan Vučica
Subject: Re: Unresolved Issues with libxml2
Date: Sat, 17 Mar 2012 17:39:53 +0100

Hi Fred, all,

On Thu, Mar 8, 2012 at 17:40, Ivan Vučica <address@hidden> wrote:
On Wed, Mar 7, 2012 at 23:33, Fred Kiefer <address@hidden> wrote:

Ah, now I see where the misunderstanding comes from. Here is your code for replacementClassForClass:


+(Class)replacementClassForClass:(Class)cls
{
   if(cls == [NSXMLElement class])
   {
       return [OPMLOutlineXMLElement class];
   }
   if(cls == [NSXMLDocument class])
   {
       return [OPMLOutline class];
   }
   return cls;
}

As you can see you are not dealing with the class NSXMLNode itself. Now the big difference is that the current GNUstep code comes up with other nodes as the Apple code. Most nodes are NSXMLElement and get handled correctly by your code, but some of them are normal NSXMLNode and these get ignored.
Now what the message you get shows is that the parse or rather the whole libxml2 has a slightly different view on nodes than Apples code has. In libxml2 even the string value of a node ends up as a child node. What we could try to do is to filter out these extra nodes in our wrapper code, but this will be a huge amount of work.

Does my explanation help you to come to a common understanding of what is going on here?

Fred

Ah, I think I get it. I'll try fixing the pieces of code that don't count on the possibility of NSXMLNode appearing (probably one or two places, I remember seeing a lot of "isKindOfClass:[OPMLOutlineXMLElement class]" calls), and at some point, I'll examine the node trees under GNUstep and Cocoa to get a better understanding of what's going on.

Thanks for all the great work!


Now that the code in SlaveOPML for creating new outlines from scratch works (including saving), I've spent some time trying to figure out why the program crashes at opening the app. I'm stuck near the beginning; all I could figure out is the stack trace.

Crash occurs immediately after choosing the file to open, either via the "Open Recent" menu or via the Open panel.

Program received signal SIGSEGV, Segmentation fault.
0x00ff4a8c in free () from /lib/tls/i686/cmov/libc.so.6
(gdb) bt
#0  0x00ff4a8c in free () from /lib/tls/i686/cmov/libc.so.6
#1  0x0167fbfc in xmlFreeNodeList () from /usr/lib/libxml2.so.2
#2  0x0167fc35 in xmlFreeNodeList () from /usr/lib/libxml2.so.2
#3  0x0168055f in xmlFreeNode () from /usr/lib/libxml2.so.2
#4  0x00cad2bd in -[NSXMLNode dealloc] (self=0x87f72bc, _cmd=0xef2d18) at NSXMLNode.m:1038
#5  0x00ca5c45 in -[NSXMLElement dealloc] (self=0x87f72bc, _cmd=0xece3b8) at NSXMLElement.m:49
#6  0x00b83045 in -[NSObject release] (self=0x87f72bc, _cmd=0xeaa150) at NSObject.m:2049
#7  0x00a4b8c1 in -[NSAutoreleasePool emptyPool] (self=0x819beac, _cmd=0xeaa0f8) at NSAutoreleasePool.m:656
#8  0x00a4b451 in -[NSAutoreleasePool dealloc] (self=0x819beac, _cmd=0xeaa160) at NSAutoreleasePool.m:538
#9  0x00a4b3d0 in -[NSAutoreleasePool release] (self=0x819beac, _cmd=0x7f4c98) at NSAutoreleasePool.m:531
#10 0x0030858e in -[NSApplication run] (self=0x82ec224, _cmd=0x7ee948) at NSApplication.m:1580
#11 0x002ccd21 in NSApplicationMain (argc=1, argv=0xbffff2b4) at Functions.m:91
#12 0x0804efaa in main (argc=1, argv=0xbffff2b4) at OPML/main.m:13

Crash seems to happen somewhere in NSXMLElement/NSXMLNode, in a call to libxml2.

This happens after my -(id)initWithOPMLData:(NSData*)data error:(NSError**)error has finished already. Although it works when I create a blank outline, it fails miserably even if I add return [self initWithBlankOutline]; as the first line of initWithOPMLData:error:.

I'm really unsure how to proceed with debugging. Turning on zombies didn't help since the crash occurs in libxml2. I've tried removing some autoreleases, but to no avail.

NSXMLDocument subclass is not released upon loading (that wouldn't make sense) and the app works under Cocoa. In fact, I don't really see what I'm autoreleasing.

Does anyone have some tips on what I can do? 

Alternatively, if anyone is willing to directly look at the problem, to make testing easier I've also added "example.opml" to the repository which is, as always, available at:
  http://bitbucket.org/ivucica/opml

-- 
Ivan Vučica - address@hidden



reply via email to

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