1. Jeremy Reichman
  2. pyobjc

Commits

Just van Rossum  committed 0bf47cc

explain why the delegate must be retained

  • Participants
  • Parent commits e4a27e2
  • Branches default

Comments (0)

Files changed (1)

File pyobjc/Examples/HelloWorld.py

View file
  • Ignore whitespace
 def main():
     NSApp = NSApplication.sharedApplication()
 
+    # we must keep a reference to the delegate object ourselves,
+    # NSApp.setDelegate_() doesn't retain it. A local variable is
+    # enough here.
     delegate = AppDelegate.alloc().init()
     NSApp.setDelegate_(delegate)