Skip to content

Commit 4dfc759

Browse files
Workspace delegate weak variable. (#3148)
1 parent 92c0d9c commit 4dfc759

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Sources/Commands/SwiftTool.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ public class SwiftTool {
304304
/// workspace is not needed, infact it would be an error to ask for the workspace object
305305
/// for package init because the Manifest file should *not* present.
306306
private var _workspace: Workspace?
307+
private var _workspaceDelegate: ToolWorkspaceDelegate?
307308

308309
/// Create an instance of this tool.
309310
///
@@ -514,6 +515,7 @@ public class SwiftTool {
514515
cachePath: try self.getCachePath()
515516
)
516517
_workspace = workspace
518+
_workspaceDelegate = delegate
517519
return workspace
518520
}
519521

Sources/Workspace/Workspace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private class WorkspaceRepositoryManagerDelegate: RepositoryManagerDelegate {
183183
/// This class does *not* support concurrent operations.
184184
public class Workspace {
185185
/// The delegate interface.
186-
public let delegate: WorkspaceDelegate?
186+
public weak var delegate: WorkspaceDelegate?
187187

188188
/// The path of the workspace data.
189189
public let dataPath: AbsolutePath

0 commit comments

Comments
 (0)