Skip to content

Commit

Permalink
objc crashes if these objects are garbage collected
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Feb 24, 2023
1 parent 5be96c4 commit 0b9801d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xpra/platform/darwin/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ def normalize_precision(distance):
@objc.python_method
def register_sleep_handlers(self):
log("register_sleep_handlers()")
workspace = NSWorkspace.sharedWorkspace()
notificationCenter = workspace.notificationCenter()
self.workspace = NSWorkspace.sharedWorkspace()
self.notificationCenter = self.workspace.notificationCenter()
def add_observer(fn, val):
notificationCenter.addObserver_selector_name_object_(self, fn, val, None)
self.notificationCenter.addObserver_selector_name_object_(self, fn, val, None)
#NSWorkspaceWillPowerOffNotification
add_observer(self.receiveSleepNotification_, NSWorkspaceWillSleepNotification)
add_observer(self.receiveWakeNotification_, NSWorkspaceDidWakeNotification)
Expand Down

0 comments on commit 0b9801d

Please sign in to comment.