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
Original file line number Diff line number Diff line change
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

0 comments on commit 6d2375b

Please sign in to comment.