瀏覽代碼

Use strongDelegate to fix error: weak property may be unpredictably set to nil

Myles Abbott 11 年之前
父節點
當前提交
e77fc99138
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Masonry/MASCompositeConstraint.m

+ 2 - 1
Masonry/MASCompositeConstraint.m

@@ -39,7 +39,8 @@
 }
 
 - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
-    MASConstraint *newConstraint = [self.delegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
+    id<MASConstraintDelegate> strongDelegate = self.delegate;
+    MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
     newConstraint.delegate = self;
     [self.childConstraints addObject:newConstraint];
     return newConstraint;