aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCustomQuery.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2018-01-17 20:21:07 +0100
committerMax <post@wickenrode.com>2018-01-17 20:21:07 +0100
commitef21bc5c3749756c21804d1592f3a3fe2faf7cab (patch)
treec52405f115536abcbd9861c40f740521d40bf6d8 /Source/SPCustomQuery.m
parent74b18eee1821ec8ec5bd472cd5ddb80eb865c1ed (diff)
downloadsequelpro-ef21bc5c3749756c21804d1592f3a3fe2faf7cab.tar.gz
sequelpro-ef21bc5c3749756c21804d1592f3a3fe2faf7cab.tar.bz2
sequelpro-ef21bc5c3749756c21804d1592f3a3fe2faf7cab.zip
Remove another 2 cases of very strange object notification behavior (code style)
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r--Source/SPCustomQuery.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index abd4c2a8..374f31db 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -72,6 +72,7 @@
+ (NSString *)linkToHelpTopic:(NSString *)aTopic;
- (void)documentWillClose:(NSNotification *)notification;
- (void)queryFavoritesHaveBeenUpdated:(NSNotification *)notification;
+- (void)historyItemsHaveBeenUpdated:(NSNotification *)notification;
@end
@@ -1621,7 +1622,7 @@
#ifndef SP_CODA
if ( [[SPQueryController sharedQueryController] historyForFileURL:[tableDocumentInstance fileURL]] )
- [self performSelectorOnMainThread:@selector(historyItemsHaveBeenUpdated:) withObject:self waitUntilDone:YES];
+ [self performSelectorOnMainThread:@selector(historyItemsHaveBeenUpdated:) withObject:nil waitUntilDone:YES];
// Populate query favorites
[self queryFavoritesHaveBeenUpdated:nil];
@@ -3369,8 +3370,12 @@
/**
* Rebuild history popup menu.
+ *
+ * Warning: notification may be nil if invoked directly from within this class.
+ *
+ * MUST BE CALLED ON THE UI THREAD!
*/
-- (void)historyItemsHaveBeenUpdated:(id)manager
+- (void)historyItemsHaveBeenUpdated:(NSNotification *)notification
{
// Abort if the connection has been closed already - sign of a closed window
if (![mySQLConnection isConnected]) return;
@@ -3997,6 +4002,10 @@
selector:@selector(queryFavoritesHaveBeenUpdated:)
name:SPQueryFavoritesHaveBeenUpdatedNotification
object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(historyItemsHaveBeenUpdated:)
+ name:SPHistoryItemsHaveBeenUpdatedNotification
+ object:nil];
#ifndef SP_CODA
[prefs addObserver:self forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL];