Fix remote workspace view lifetime after reproduced XPC crash; retain all-Vision tracking
这个提交包含在:
1 父节点
8af7013ad4
当前提交
867bcfbad3
14 个文件已更改
+173
-39
没有与搜索条件相匹配的文件
@@ -168,7 +168,10 @@ static BOOL DYWorkspaceEnabled(DYUniforms u,NSString *type){if([type isEqual:@"b
|
||||
}@finally{[action endAction:self];}
|
||||
}
|
||||
- (void)attachToParent:(NSView *)parent{
|
||||
if(_remoteParent!=parent){if(_remoteParent)for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter removeObserver:self name:name object:_remoteParent];_remoteParent=parent;
|
||||
// FxPlug may discard its view before the deferred presentation callback runs
|
||||
// (notably while an NSMenu owns the event loop). Own the borrowed parent for
|
||||
// the entire attachment, rather than leaving a dangling geometry pointer.
|
||||
if(_remoteParent!=parent){if(_remoteParent)for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter removeObserver:self name:name object:_remoteParent];[parent retain];[_remoteParent release];_remoteParent=parent;
|
||||
parent.postsFrameChangedNotifications=YES;parent.postsBoundsChangedNotifications=YES;for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(parentChanged:) name:name object:parent];
|
||||
}
|
||||
[_root removeFromSuperview];_root.frame=parent.bounds;_root.autoresizingMask=NSViewWidthSizable|NSViewHeightSizable;[parent addSubview:_root];_visible=YES;_root.hidden=NO;[self refreshToolWorkspace:nil];[self pageChanged:nil];[self parentChanged:nil];
|
||||
@@ -178,7 +181,7 @@ static BOOL DYWorkspaceEnabled(DYUniforms u,NSString *type){if([type isEqual:@"b
|
||||
});
|
||||
}
|
||||
- (void)parentChanged:(NSNotification *)notification{
|
||||
if(!_visible||!_remoteParent)return;NSWindow *window=_remoteParent.window;
|
||||
if(!_visible||!_remoteParent||_root.superview!=_remoteParent)return;NSWindow *window=_remoteParent.window;
|
||||
if(window&&_remoteParent==window.contentView&&_remoteParent.superview){NSRect content=[window convertRectFromScreen:[window contentRectForFrameRect:window.frame]];NSPoint origin=[_remoteParent.superview convertPoint:content.origin fromView:nil];if(std::isfinite(origin.x)&&std::isfinite(origin.y)&&!NSEqualPoints(_remoteParent.frame.origin,origin))[_remoteParent setFrameOrigin:origin];}
|
||||
_root.frame=_remoteParent.bounds;[self layoutWorkspace];
|
||||
}
|
||||
@@ -287,13 +290,13 @@ static BOOL DYWorkspaceEnabled(DYUniforms u,NSString *type){if([type isEqual:@"b
|
||||
}
|
||||
- (void)closePressed:(id)sender{[self close];}
|
||||
- (void)toggleWorkspaceSize:(id)sender{BOOL expanded=!_expanded;[self close];_expanded=expanded;[self showRelativeToView:nil];}
|
||||
- (void)remoteClosed:(NSNotification *)notification{_closing=YES;[self close];_closing=NO;}
|
||||
- (void)remoteClosed:(NSNotification *)notification{if(notification.object!=_presentationWindow)return;_closing=YES;[self close];_closing=NO;}
|
||||
- (void)close{
|
||||
if(_closed)return;BOOL hadPresentation=_visible||_opening||_remoteParent;_closed=YES;_visible=NO;_opening=NO;_session++;_selectionID++;[_selectionTask cancel];[_selectionTask release];_selectionTask=nil;[_renderer setScopeEnabled:NO];
|
||||
[_trackingPreview reset];[self setTrackingPreviewVisible:NO];
|
||||
BOOL wasClosing=_closing;_closing=YES;[_browser close];[_browser release];_browser=nil;
|
||||
[_toolEditor removeFromSuperview];[_toolEditor release];_toolEditor=nil;[_editorNode release];_editorNode=nil;_maskScroll.documentView=nil;[_maskEditor release];_maskEditor=nil;[_maskNode release];_maskNode=nil;
|
||||
if(_remoteParent)for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter removeObserver:self name:name object:_remoteParent];_remoteParent=nil;
|
||||
if(_remoteParent)for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter removeObserver:self name:name object:_remoteParent];[_root removeFromSuperview];[_remoteParent release];_remoteParent=nil;
|
||||
if(_presentationWindow)[NSNotificationCenter.defaultCenter removeObserver:self name:NSWindowWillCloseNotification object:_presentationWindow];[_presentationWindow release];_presentationWindow=nil;[_root removeFromSuperview];
|
||||
if(hadPresentation&&!wasClosing){id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(action){[action startAction:self];@try{id<FxRemoteWindowAPI_v3> api=[_manager apiForProtocol:@protocol(FxRemoteWindowAPI_v3)];[api closeRemoteWindow];}@finally{[action endAction:self];}}}_closing=wasClosing;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#import "DYColorWorkspace.h"
|
||||
// Offscreen fixtures: no window is ordered onto the user's screen.
|
||||
static NSUInteger DYWorkspaceEphemeralParentDeallocations=0;
|
||||
@interface DYWorkspaceEphemeralParent : NSView
|
||||
@end
|
||||
@implementation DYWorkspaceEphemeralParent
|
||||
- (void)dealloc{++DYWorkspaceEphemeralParentDeallocations;[super dealloc];}
|
||||
@end
|
||||
@interface DYColorWorkspace (DiagnosticActions)
|
||||
- (NSDictionary *)selectionContext;
|
||||
- (void)showPage:(NSString *)page maskKind:(NSNumber *)kind;
|
||||
|
||||
@@ -8,6 +8,21 @@
|
||||
}
|
||||
{
|
||||
auto workspaceDrain=[](){double end=NSProcessInfo.processInfo.systemUptime+.04;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};
|
||||
// Reproduce host ownership ending before the queued geometry callback. This
|
||||
// previously dereferenced a freed FxXPView in parentChanged: on the main queue.
|
||||
NSUInteger ephemeralBefore=DYWorkspaceEphemeralParentDeallocations;
|
||||
@autoreleasepool {
|
||||
DYWorkspaceDiagnosticHost *ephemeralHost=[[[DYWorkspaceDiagnosticHost alloc]init]autorelease];DYCreateParameters(ephemeralHost,&error);
|
||||
DYWorkspaceDiagnosticRenderer *ephemeralRenderer=[[[DYWorkspaceDiagnosticRenderer alloc]init]autorelease];
|
||||
DYLUTLibrary *ephemeralLibrary=[[[DYLUTLibrary alloc]initWithRootURL:[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"ephemeral-library"]]]autorelease];
|
||||
NSView *parent=[[DYWorkspaceEphemeralParent alloc]initWithFrame:NSMakeRect(0,0,1120,360)];ephemeralHost->_parent=parent;
|
||||
NSUInteger before=DYWorkspaceEphemeralParentDeallocations;
|
||||
DYColorWorkspace *owned=[[DYColorWorkspace alloc]initWithManager:ephemeralHost renderer:ephemeralRenderer library:ephemeralLibrary title:@"生命周期"];
|
||||
[owned showRelativeToView:nil];[parent release];BOOL retained=DYWorkspaceEphemeralParentDeallocations==before;
|
||||
workspaceDrain();run.record(@"workspace-owns-remote-parent-through-deferred-geometry",retained&&owned.visible&&[(NSView*)[owned valueForKey:@"root"]superview]==ephemeralHost->_parent);
|
||||
[owned close];[owned release];ephemeralHost->_parent=nil;workspaceDrain();
|
||||
}
|
||||
run.record(@"workspace-releases-owned-remote-parent-on-close",DYWorkspaceEphemeralParentDeallocations==ephemeralBefore+1);
|
||||
NSString *oldLUT=[runtime stringByAppendingPathComponent:@"old.cube"],*retainLUT=[runtime stringByAppendingPathComponent:@"retain.cube"],*newLUT=[runtime stringByAppendingPathComponent:@"new.cube"],*lateLUT=[runtime stringByAppendingPathComponent:@"late.cube"],*userLUT=[runtime stringByAppendingPathComponent:@"user-new.cube"],*nodeLUT=[runtime stringByAppendingPathComponent:@"node.cube"],*deletedLUT=[runtime stringByAppendingPathComponent:@"deleted.cube"];
|
||||
DYWorkspaceDiagnosticHost *host=[[[DYWorkspaceDiagnosticHost alloc]init]autorelease];DYCreateParameters(host,&error);
|
||||
DYWorkspaceDiagnosticRenderer *scopeRenderer=[[[DYWorkspaceDiagnosticRenderer alloc]init]autorelease];
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.19.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>108</string>
|
||||
<string>109</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.19.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>108</string>
|
||||
<string>109</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
在新工单中引用
屏蔽一个用户