[Pyobjc-dev] bus error in CGEventTapCreate... found the problem
Brought to you by:
ronaldoussoren
From: Ratko J. <rja...@gm...> - 2009-06-29 22:39:43
|
I am trying to capture some mouse events using CGEventTapCreate and I found out that the following causes a bus error every time: eventMask = (1<<kCGEventMouseMoved) eventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, 0, eventMask, myCGEventCallback) I've traced it down to two problems, both in Quartz framework in _callbacks.m in the function m_CGEventTapCreate: (1) the function expects 5 inputs and yet it tries to assign 6, last one being "info"... which ends up being an uninitialized pointer. That seems to cause a bus error further down when it tries to create a tuple of "callback" and "info": PyObject* real_info = Py_BuildValue("OO", callback, info); For my purposes, I just changed CGEventTapCreate to accept 6th input when parsing arguments ("OOOOOO"), as it does in carbon. Not sure if that's the right approach... (2) After fixing that, I encountered the next bus error with the line further down in the same function: CFRelease(retval); I have no idea why this is crashing but I just commented it out for now. I am assuming the worst that can happen is a memory leak and considering that I call this only once, I didn't think it was a big problem. Also, how does one compile svn trunk properly??? "easy_install pyobjc" downloads a new version when I want it to compile my modified version. Right now I have a serious hack... the whole 2.2b2 from easy_install + Quartz compiled separately from svn (2.2b3). Some system info:Mac OS X 10.5.7 Apple Python 2.5 built-in PyObjC (also tried PyObjC 2.2b2) -Ratko |