Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed the issue with onig_new thread safety

  • Loading branch information...
commit 94bf31ce68dda9f9671309b1df5ffd5ee459c261 1 parent 31755bc
@aki-null aki-null authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 framework/core/OnigRegexp.m
View
17 framework/core/OnigRegexp.m
@@ -114,13 +114,16 @@ + (OnigRegexp*)compile:(NSString*)expression options:(OnigOption)theOptions erro
regex_t* entity = 0;
const UChar* str = (const UChar*)[expression cStringUsingEncoding:STRING_ENCODING];
- int status = onig_new(&entity,
- str,
- str + [expression length] * CHAR_SIZE,
- option,
- ONIG_ENCODING,
- ONIG_SYNTAX_DEFAULT,
- &err);
+ int status;
+ @synchronized([OnigRegexp class]) {
+ status = onig_new(&entity,
+ str,
+ str + [expression length] * CHAR_SIZE,
+ option,
+ ONIG_ENCODING,
+ ONIG_SYNTAX_DEFAULT,
+ &err);
+ }
if (status == ONIG_NORMAL) {
return [[[self alloc] initWithEntity:entity expression:expression] autorelease];
Please sign in to comment.
Something went wrong with that request. Please try again.