[Pyobjc-dev] Confusing crash that's fixed by adding NSBeep()!?!
Brought to you by:
ronaldoussoren
|
From: Scott H. <sco...@gm...> - 2010-05-15 00:55:49
|
Sorry is this gets posted twice. I sent it out the other night, but never saw it show up on the list.
My goal was to make a simple demo program that has a NSView implemented in Python, a NSView implemented in ObjC and that demonstrates both languages calling each other all in one app.
Any ideas?
Thanks,
-Scott
On May 14, 2010, at 12:40 AM, Scott Harris wrote:
> I've got this obj-c object in a simple demo program:
>
>
> @implementation junker
> -(id) init
> {
> [super init];
> NSLog(@"initing");
> [self action];
> return self;
> }
> -(void) action
> {
> NSLog(@"junk");
> //NSBeep();
> }
> @end
>
> I call it from Python in my App delegate like this:
>
> from Foundation import *
> from AppKit import *
>
> class PyObjCTestAppDelegate(NSObject):
> def applicationDidFinishLaunching_(self, sender):
> NSLog("Application did finish launching.")
> self.a=junker.alloc().init()
>
> def awakeFromNib(self):
> NSLog("Awoke from NIB")
>
> @objc.IBAction
> def buttonPress_(self, sender):
> NSLog("Button pressed!")
> self.a.action()
>
> The funny thing is that the program crashes when I press the button that calls buttonPress iff NSBeep is commented out, but runs fine if the NSBeep is uncommented. Strange.
>
> Here's the console output:
> 2010-05-14 00:39:23.924 PyObjCTest[99096:a0f] Awoke from NIB
> 2010-05-14 00:39:24.006 PyObjCTest[99096:a0f] Drawing
> 2010-05-14 00:39:24.069 PyObjCTest[99096:a0f] Application did finish launching.
> 2010-05-14 00:39:24.070 PyObjCTest[99096:a0f] initing
> 2010-05-14 00:39:24.070 PyObjCTest[99096:a0f] junk
> 2010-05-14 00:39:29.781 PyObjCTest[99096:a0f] Button Pressed
> 2010-05-14 00:39:29.782 PyObjCTest[99096:a0f] junk
> Program received signal: “EXC_BAD_ACCESS”.
> sharedlibrary apply-load-rules all
>
> Any ideas?
>
> Thanks,
> -Scott
|