@@ -92,6 +92,7 @@ actor WidgetWindowsController: NSObject {
9292 try Task . checkCancellation ( )
9393 let xcodeInspector = self . xcodeInspector
9494 let activeApp = await xcodeInspector. safe. activeApplication
95+ let latestActiveXcode = await xcodeInspector. safe. latestActiveXcode
9596 await MainActor . run {
9697 let state = store. withState { $0 }
9798 let isChatPanelDetached = state. chatPanelState. chatPanelInASeparateWindow
@@ -113,8 +114,7 @@ actor WidgetWindowsController: NSObject {
113114 }
114115 } else if let activeApp, activeApp. isExtensionService {
115116 let noFocus = {
116- guard let xcode = xcodeInspector. latestActiveXcode
117- else { return true }
117+ guard let xcode = latestActiveXcode else { return true }
118118 if let window = xcode. appElement. focusedWindow,
119119 window. role == " AXWindow "
120120 {
@@ -341,7 +341,7 @@ private extension WidgetWindowsController {
341341 selectionRangeChange. debounce ( for: Duration . milliseconds ( 500 ) ) ,
342342 scroll
343343 ) {
344- guard xcodeInspector. latestActiveXcode != nil else { return }
344+ guard await xcodeInspector. safe . latestActiveXcode != nil else { return }
345345 try Task . checkCancellation ( )
346346
347347 // for better looking
@@ -354,7 +354,7 @@ private extension WidgetWindowsController {
354354 }
355355 } else {
356356 for await notification in merge ( selectionRangeChange, scroll) {
357- guard xcodeInspector. latestActiveXcode != nil else { return }
357+ guard await xcodeInspector. safe . latestActiveXcode != nil else { return }
358358 try Task . checkCancellation ( )
359359
360360 // for better looking
0 commit comments