Applied a fix/workaround to an issue where a toolbar would cease from validating itself after its window was closed and re-opened.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37068 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Frank Le Grand 2013-09-11 16:54:56 +00:00
parent a9e4f72f54
commit 624a62d838
4 changed files with 51 additions and 0 deletions

View file

@ -1,3 +1,14 @@
2013-09-11 Frank Le Grand <frank.legrand@testplant.com>
* Source\NSToolbar.m,
* Source\NSToolbarFrameworkPrivate.h,
* Source\NSWindow.h: Applied a fix/workaround to an issue where
a toolbar would cease from validating itself after its window
was closed and re-opened. The culprit is the logic in
GSValidationCenter which seems to assume that when a window has
closed it will be dealloc'd soon after, and does not consider
the possibility of the window getting brought back up.
2013-09-04 Frank Le Grand <frank.legrand@testplant.com>
* Source\NSBrowser.m: Fixed a bug where setting the path to "/" would

View file

@ -1556,6 +1556,15 @@ static GSValidationCenter *vc = nil;
[self validateVisibleItems];
}
- (void) _resetToolbarUpdates: (NSWindow *)window
{
GSValidationCenter *validationCenter = [GSValidationCenter sharedValidationCenter];
[validationCenter removeObserver: self window: nil];
if (window != nil)
{
[validationCenter addObserver: self window: window];
}
}
@end

View file

@ -35,6 +35,7 @@
#import "AppKit/NSToolbarItem.h"
#import "GNUstepGUI/GSToolbarView.h"
#import "GNUstepGUI/GSWindowDecorationView.h"
#import "AppKit/NSWindow.h"
@interface GSToolbarView (GNUstepPrivate)
- (void) _reload;
@ -114,6 +115,9 @@
- (NSArray *) _selectableItemIdentifiers;
- (NSToolbarItem *) _toolbarItemForIdentifier: (NSString *)itemIdent willBeInsertedIntoToolbar: (BOOL)insert;
// Validation management
- (void) _resetToolbarUpdates: (NSWindow *)window;
@end
@interface GSWindowDecorationView (ToolbarPrivate)
@ -126,4 +130,8 @@
- (NSMenuView*) removeMenuView;
@end
@interface NSWindow (ToolbarPrivate)
- (void) _resetToolbarUpdates;
@end
#endif // _NSToolbarFrameworkPrivate_h_INCLUDE

View file

@ -1571,6 +1571,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
[_wv setInputState: GSTitleBarKey];
[GSServerForWindow(self) setinputfocus: _windowNum];
[self _resetToolbarUpdates];
[self resetCursorRects];
[nc postNotificationName: NSWindowDidBecomeKeyNotification object: self];
NSDebugLLog(@"NSWindow", @"%@ is now key window", [self title]);
@ -5780,6 +5781,28 @@ current key view.<br />
}
@end
@implementation NSWindow (ToolbarPrivate)
- (void) _resetToolbarUpdates
{
/* 2013-09-11 Frank LeGrand: The toolbar validation process is
* architectured around the GSValidationCenter and its validation
* objects, which remove notification observers when the window
* closes (see NSToolbar.m). This architecture seems to assume
* that when a window closes it will be dealloc'd soon after, this
* is incorrect as someone else maybe retaining the window and later
* show it again. The purpose of this patch is to "turn on" again
* the validation process of the toolbar.
*/
if ([self toolbar])
{
[[self toolbar] _resetToolbarUpdates:self];
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
}
}
@end
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo)
{
NSPasteboard *pb = [dragInfo draggingPasteboard];