Release the key value binding as it will be

retained in the binding table.
Leak found by static code analyser.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32484 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-03-07 13:35:37 +00:00
parent fcfa7dafb4
commit a953d2bda0
8 changed files with 87 additions and 43 deletions

View file

@ -1,3 +1,15 @@
2011-03-07 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m
* Source/NSObjectController.m
* Source/NSControl.m
* Source/NSMenuItem.m
* Source/NSKeyValueBinding.m
* Source/NSTextField.m
* Source/NSView.m: Release the key value binding as it will be
retained in the binding table.
Leak found by static code analyser.
2011-03-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSMatrix.m (-_privateFrame:...numberOfColumns): Change

View file

@ -1004,25 +1004,33 @@ static NSNotificationCenter *nc;
{
if ([binding isEqual: NSValueBinding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
// FIXME: We could also do the mapping via
// setKeys:triggerChangeNotificationsForDependentKey:
[[GSKeyValueBinding alloc] initWithBinding: @"objectValue"
withName: NSValueBinding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
kvb = [[GSKeyValueBinding alloc] initWithBinding: @"objectValue"
withName: NSValueBinding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else if ([binding hasPrefix: NSEnabledBinding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
[[GSKeyValueAndBinding alloc] initWithBinding: NSEnabledBinding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
kvb = [[GSKeyValueAndBinding alloc] initWithBinding: NSEnabledBinding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else
{

View file

@ -90,13 +90,17 @@
if ([[self exposedBindings] containsObject: binding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
[[GSKeyValueBinding alloc] initWithBinding: binding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
kvb = [[GSKeyValueBinding alloc] initWithBinding: binding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else
{

View file

@ -766,13 +766,17 @@ static Class imageClass;
{
if ([binding hasPrefix: NSEnabledBinding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
[[GSKeyValueAndBinding alloc] initWithBinding: NSEnabledBinding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
kvb = [[GSKeyValueAndBinding alloc] initWithBinding: NSEnabledBinding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else
{

View file

@ -216,13 +216,17 @@
{
if ([binding isEqual:NSContentObjectBinding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
[[GSKeyValueBinding alloc] initWithBinding: @"content"
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
kvb = [[GSKeyValueBinding alloc] initWithBinding: @"content"
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else
{

View file

@ -788,13 +788,17 @@ static Class textFieldCellClass;
{
if ([binding hasPrefix: NSEditableBinding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
[[GSKeyValueAndBinding alloc] initWithBinding: NSEditableBinding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
kvb = [[GSKeyValueAndBinding alloc] initWithBinding: NSEditableBinding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else
{

View file

@ -4967,13 +4967,17 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
{
if ([binding hasPrefix: NSHiddenBinding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
[[GSKeyValueOrBinding alloc] initWithBinding: NSHiddenBinding
kvb = [[GSKeyValueOrBinding alloc] initWithBinding: NSHiddenBinding
withName: binding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else
{

View file

@ -5314,13 +5314,17 @@ current key view.<br />
{
if ([binding isEqual: NSTitleBinding])
{
GSKeyValueBinding *kvb;
[self unbind: binding];
[[GSKeyValueBinding alloc] initWithBinding: @"title"
withName: NSTitleBinding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
kvb = [[GSKeyValueBinding alloc] initWithBinding: @"title"
withName: NSTitleBinding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
// The binding will be retained in the binding table
RELEASE(kvb);
}
else
{