Revision: 29176
          http://sourceforge.net/p/bibdesk/svn/29176
Author:   hofman
Date:     2025-04-23 21:51:29 +0000 (Wed, 23 Apr 2025)
Log Message:
-----------
Checks to balance adding and removing notification observer when moving to a 
superview. The hooks are called twice for each move.

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2025-04-23 
16:56:12 UTC (rev 29175)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2025-04-23 
21:51:29 UTC (rev 29176)
@@ -1127,7 +1127,7 @@
         
         [[NSNotificationCenter defaultCenter] removeObserver:self 
name:FVPreviewerWillCloseNotification object:nil];
     }
-    else {
+    else if ([self superview] == nil) {
         [[NSNotificationCenter defaultCenter] addObserver:self
                                                  
selector:@selector(handlePreviewerWillClose:)
                                                      
name:FVPreviewerWillCloseNotification
@@ -1139,7 +1139,8 @@
         [self addSubview:_backgroundView positioned:NSWindowBelow 
relativeTo:nil];
     }
     
-    [[NSNotificationCenter defaultCenter] removeObserver:self 
name:NSViewFrameDidChangeNotification object:nil];
+    if ([self superview])
+        [[NSNotificationCenter defaultCenter] removeObserver:self 
name:NSViewFrameDidChangeNotification object:nil];
 }
 
 - (void)viewDidMoveToSuperview {
@@ -1156,7 +1157,7 @@
         if ([self window] && [[self window] isKeyWindow] == NO)
             [self resetCursorRects];
         
-        if (scrollView) {
+        if (scrollView && [_backgroundView superview] != scrollView) {
             [_backgroundView setFrame:[scrollView bounds]];
             [scrollView addSubview:_backgroundView positioned:NSWindowBelow 
relativeTo:nil];
             [scrollView setDrawsBackground:NO];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to