Skip to content

Commit 2d0c4c8

Browse files
committed
Fix infinite loop and memory leak in DockTilePlugin
The ghosttyAppPath property searched for hardcoded "Ghostty.app" in the bundle path, but the app is named "Ghostree.app". The loop walked past root where URL.deletingLastPathComponent() appends "/.." indefinitely, causing unbounded memory growth in the Dock Extra process even when the app is not running. Match by .app path extension instead of hardcoded name.
1 parent 880fd6e commit 2d0c4c8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

macos/Sources/Features/Custom App Icon/DockTilePlugin.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ class DockTilePlugin: NSObject, NSDockTilePlugIn {
2020

2121
private var iconChangeObserver: Any?
2222

23-
/// The path to the Ghostty.app, determined based on the bundle path of this plugin.
23+
/// The path to the host .app bundle, determined based on the bundle path of this plugin.
2424
var ghosttyAppPath: String {
2525
var url = pluginBundle.bundleURL
26-
// Remove "/Contents/PlugIns/DockTilePlugIn.bundle" from the bundle URL to reach Ghostty.app.
27-
while url.lastPathComponent != "Ghostty.app", !url.lastPathComponent.isEmpty {
26+
// Walk up from "*.app/Contents/PlugIns/DockTilePlugin.plugin" to reach the .app bundle.
27+
while url.pathExtension != "app", url.path != "/" {
2828
url.deleteLastPathComponent()
2929
}
3030
return url.path

0 commit comments

Comments
 (0)