Skip to content

Commit

Permalink
Fixed an issue where a call to -abortParsing from a thread other than…
Browse files Browse the repository at this point in the history
… the parsing thread could cause a crash.
  • Loading branch information
AlanQuatermain committed May 17, 2009
1 parent 3d954f2 commit 6d2375b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions StreamingXMLParser/AQXMLParser.m
Expand Up @@ -978,6 +978,9 @@ - (void) stream: (NSStream *) stream handleEvent: (NSStreamEvent) streamEvent

case NSStreamEventHasBytesAvailable:
{
if ( _internal->delegateAborted )
break;

uint8_t buf[1024];
int len = [input read: buf maxLength: 1024];
if ( len > 0 )
Expand All @@ -995,6 +998,7 @@ - (void) abortParsing

_internal->delegateAborted = YES;
xmlStopParser( _internal->parserContext );
[self _setStreamComplete: NO]; // must tell any async delegates that we're done parsing
}

- (NSError *) parserError
Expand Down

1 comment on commit 6d2375b

@tkirby
Copy link

@tkirby tkirby commented on 6d2375b Feb 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the NSStreamEventEndEncountered case also have the delegateAborted guard...

case NSStreamEventEndEncountered:
if ( _internal->delegateAborted )
break;

...so it doesn't try to call xmlParseChunk?

Please sign in to comment.