From 38db22db06cc7e7dc4d98941b1c0f067cc6af466 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Fri, 15 Apr 2011 16:00:18 +0200 Subject: [PATCH] fix a decoding bug with CPBox and it's contentView --- AppKit/CPView.j | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 2a5bdc2be..bd2a5be03 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -2629,7 +2629,11 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", _registeredDraggedTypes = [CPSet set]; _registeredDraggedTypesArray = []; - _autoresizingMask = [aCoder decodeIntForKey:CPViewAutoresizingMaskKey] || CPViewNotSizable; + // Other views (CPBox) might set an autoresizes mask on their subviews before it is actually decoded. + // We make sure we don't override the value by checking if it was already set. + if (_autoresizingMask === nil) + _autoresizingMask = [aCoder decodeIntForKey:CPViewAutoresizingMaskKey] || CPViewNotSizable; + _autoresizesSubviews = ![aCoder containsValueForKey:CPViewAutoresizesSubviewsKey] || [aCoder decodeBoolForKey:CPViewAutoresizesSubviewsKey]; _hitTests = ![aCoder containsValueForKey:CPViewHitTestsKey] || [aCoder decodeObjectForKey:CPViewHitTestsKey];