[Pythonmac-SIG] PyObjC: debugging error-less crashes?
anjiro at cc.gatech.edu
Thu Jul 24 01:18:24 CEST 2008
Ahh, that did it. Awesome, thanks. These occasional "add a decorator to
avoid random crash" problems are very confusing... guess I'll figure it
all out as I go along.
Gary Bernhardt wrote:
> You need to wrap you alertEnded... method with
> def alertEnded(self, alert, choice, context):
> (Methods wrapped with endSheetMethod don't need the ObjC name
> mangling, so you can name it whatever you want.)
> I have a very weak understanding of why this is needed, but it's
> something related to sheet callback methods not having a fixed
> On Wed, Jul 23, 2008 at 11:57 AM, Daniel Ashbrook <anjiro at cc.gatech.edu> wrote:
>> I'm working my way through the excellent book "Cocoa Programming for Mac OS
>> X", but using PyObjC instead of ObjC. For the most part it's working very
>> well - a testament to the awesomeness of PyObjC!
>> However, I'm occasionally getting a crash from my application that gives no
>> errors - it just enters into the debugger with no other output. A backtrace
>> leads through C code to (inevitably) objc_msgSend(), which doesn't help
>> In one case I managed to figure out that I needed to add myFunc_ =
>> objc.accessor(myFunc_) after the definition of myFunc_() (though I have no
>> clue why), but in the current case that doesn't help. The relevant chunk of
>> code is below. My debug log shows the "Ending alert sheet" message, but not
>> the "Alert ended" message.
>> def removeEmployee_(self, sender):
>> selectedPeople = self._employeeController.selectedObjects()
>> alert =
>> u'Delete', u'Cancel', None, u'Do you really want to delete %d people?' %
>> NSLog(u'Starting alert sheet')
>> self, 'alertEnded:code:context:', None)
>> NSLog(u'Ending alert sheet')
>> def alertEnded_code_context_(self, alert, choice, context):
>> NSLog(u'Alert ended')
>> if choice == NSAlertDefaultReturn:
>> Thanks in advance for any hints, whether general or specific!
>> Daniel Ashbrook
>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
More information about the Pythonmac-SIG