Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appledoc crashes in initialize metthod in GRMustacheImplicitIteratorExpression.m #84

Closed
snowflake opened this issue Oct 2, 2014 · 5 comments

Comments

@snowflake
Copy link

appledoc is crashing in GRMustacheImplicitIteratorExpression.m

I have filed a bug report at

tomaz/appledoc#483

The offending code is here:

+ (void)initialize                                                              
{                                                                               
    instance = [[self alloc] init];  // <-- crashes here                                             
}         

The crash only seems to happen on OSX 10.8.5 compiled with
Xcode Version 5.1.1 (5B1008) as others have not reported a crash.

I cannot see any problems with the code, but it just does not work.

Here is a suggested patch:

diff --git a/src/classes/Compiling/Expressions/GRMustacheImplicitIteratorExpression.m b/src/classes/Compiling/Expressions/GRMustacheImplicitIteratorExpression.m
index b28fc78..ffe049e 100644
--- a/src/classes/Compiling/Expressions/GRMustacheImplicitIteratorExpression.m
+++ b/src/classes/Compiling/Expressions/GRMustacheImplicitIteratorExpression.m
@@ -27,13 +27,12 @@ static GRMustacheImplicitIteratorExpression *instance;

 @implementation GRMustacheImplicitIteratorExpression

-+ (void)initialize
-{
-    instance = [[self alloc] init];
-}

 + (instancetype)expression
 {
+    if(instance == nil){
+        instance = [[GRMustacheImplicitIteratorExpression alloc] init];
+    }
     return instance;
 }

The only problem with it is that expression must be the first method
called in the class.

@groue
Copy link
Owner

groue commented Oct 2, 2014

Hi @snowflake
Are you able to reproduce the crash outside of AppleDoc?

@snowflake
Copy link
Author

Are you able to reproduce the crash outside of AppleDoc?

No. Appledoc is the only app I know of that uses GRMustache.

@groue
Copy link
Owner

groue commented Oct 2, 2014

Hm. That's unfortunate. I mean: the line that crashes is very innocent. Upon further investigation, done by you or by @tomaz, I'm reluctant to consider that the issue belongs to GRMustache. I thus consider tomaz/appledoc#483 the only relevant issue. Please open a new GRMustache issue when the responsibility has been elucidated.

@snowflake
Copy link
Author

I suspect that the bug is due to an obscure operating system bug which Apple have quietly
fixed in Mavericks. I accept that you want to close this issue, and I will just have
to apply the patch locally until I get Mavericks or Yosemite.

Using the debugger, I established that the alloc and init were being applied to
a self which was nil.

@groue
Copy link
Owner

groue commented Oct 2, 2014

Please, I beg you, put your comments in the appledoc issue. I'm being nice because I'm answering you. Yet the real repo with the real issue is Apoledoc. Please show me you understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants