Skip to content

Commit

Permalink
Make contentRect accessors atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Dec 14, 2014
1 parent 98bf7c3 commit 82c5806
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions MacDown/Code/View/MPEditorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ NS_INLINE BOOL MPAreRectsEqual(NSRect r1, NSRect r2)

@interface MPEditorView ()

@property (nonatomic) NSRect contentRect;
@property NSRect contentRect;
@property CGFloat trailingHeight;

@end
Expand Down Expand Up @@ -57,9 +57,18 @@ - (void)setScrollsPastEnd:(BOOL)scrollsPastEnd

- (NSRect)contentRect
{
if (MPAreRectsEqual(_contentRect, NSZeroRect))
return self.frame;
return _contentRect;
@synchronized(self) {
if (MPAreRectsEqual(_contentRect, NSZeroRect))
return self.frame;
return _contentRect;
}
}

- (void)setContentRect:(NSRect)rect
{
@synchronized(self) {
_contentRect = rect;
}
}

- (void)setFrameSize:(NSSize)newSize
Expand Down

0 comments on commit 82c5806

Please sign in to comment.