mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 22:00:38 +00:00
Fix a problem where owner, firstResponder and application
were put in the list of top-level objects, creating a retain-cycle. Fix a problem where view and window controllers did not release their top-level objects as expected. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@36127 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
562a722ac1
commit
b40571e9c5
4 changed files with 31 additions and 5 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2013-02-13 Jonathan Gillaspie <jonathan.gillaspie@testplant.com>
|
||||
|
||||
* Source\GSXibLoader.m: Fix a problem where owner, firstResponder and application
|
||||
were put in the list of top-level objects, creating a retain-cycle.
|
||||
* Source\NSViewController.m: Fix a problem where view controllers did not release
|
||||
their top-level objects as expected.
|
||||
* Source\NSWindowController.m: Fix a problem where WindowControllers did not release
|
||||
their top-level objects as expected.
|
||||
|
||||
Changes made in occordance with
|
||||
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html
|
||||
|
||||
2013-01-31 Doug Simons <doug.simons@testplant.com>
|
||||
|
||||
* Source/NSTableView.m: Allow a non-selected row to be dragged.
|
||||
|
|
|
@ -872,13 +872,17 @@
|
|||
|
||||
if (obj != nil)
|
||||
{
|
||||
[topLevelObjects addObject: obj];
|
||||
// All top level objects must be released by the caller to avoid
|
||||
// leaking, unless they are going to be released by other nib
|
||||
// objects on behalf of the owner.
|
||||
// IGNORE file's owner, first responder and NSApplication instances...
|
||||
if ((obj != owner) && (obj != first) && (obj != app))
|
||||
// Those are NOT top level objects, and in particular putting the owner in the topLevelObjects list creates a retain cycle
|
||||
// https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html
|
||||
// also consistent with GSNibLoading.m: nibInstantiateWithOwner: (id)owner topLevelObjects:
|
||||
if ((obj != owner) && (obj != first) && (obj != app)) {
|
||||
[topLevelObjects addObject: obj];
|
||||
// All top level objects must be released by the caller to avoid
|
||||
// leaking, unless they are going to be released by other nib
|
||||
// objects on behalf of the owner.
|
||||
RETAIN(obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (([obj isKindOfClass: [NSMenu class]]) &&
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#import <Foundation/NSBundle.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSArray.h>
|
||||
#import "AppKit/NSKeyValueBinding.h"
|
||||
#import "AppKit/NSNib.h"
|
||||
#import "AppKit/NSViewController.h"
|
||||
|
@ -49,6 +50,10 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
// View Controllers are expect to release their own top-level objects
|
||||
// https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html
|
||||
[_topLevelObjects makeObjectsPerformSelector:@selector(release)];
|
||||
|
||||
DESTROY(_nibName);
|
||||
DESTROY(_nibBundle);
|
||||
DESTROY(_representedObject);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
#import <Foundation/NSBundle.h>
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSException.h>
|
||||
|
@ -129,6 +130,10 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
// View Controllers are expect to release their own top-level objects
|
||||
// https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html
|
||||
[_top_level_objects makeObjectsPerformSelector:@selector(release)];
|
||||
|
||||
[self setWindow: nil];
|
||||
RELEASE(_window_nib_name);
|
||||
RELEASE(_window_nib_path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue