[MacRuby] #876: EXC_BAD_ACCESS using IOBluetooth
MacRuby
ruby-noreply at macosforge.org
Wed Sep 1 04:45:16 PDT 2010
#876: EXC_BAD_ACCESS using IOBluetooth
-------------------------------------------+--------------------------------
Reporter: matt.wizeman@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: critical | Milestone:
Component: MacRuby | Keywords:
-------------------------------------------+--------------------------------
Comment(by matt.wizeman@…):
Sorry for the delayed response. Here is the output of my gdb session:
{{{
(gdb) bt
#0 0x00007fff883d35f0 in object_getClass ()
#1 0x00000001000ed2d3 in rb_objc_nsnumber2numeric ()
#2 0x000000010354cf40 in ?? ()
#3 0x00007fff811b0dd6 in -[IOBluetoothL2CAPChannel processIncomingData:]
()
#4 0x00007fff811af767 in -[IOBluetoothL2CAPChannel handleMachMessage:] ()
#5 0x00007fff804c007f in __NSFireMachPort ()
#6 0x00007fff82426bce in __CFMachPortPerform ()
#7 0x00007fff823ff171 in __CFRunLoopRun ()
#8 0x00007fff823fd84f in CFRunLoopRunSpecific ()
#9 0x00007fff8375491a in RunCurrentEventLoopInMode ()
#10 0x00007fff8375471f in ReceiveNextEventCommon ()
#11 0x00007fff837545d8 in BlockUntilNextEventMatchingListInMode ()
#12 0x00007fff8156429e in _DPSNextEvent ()
#13 0x00007fff81563bed in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#14 0x00007fff815298d3 in -[NSApplication run] ()
#15 0x00007fff815225f8 in NSApplicationMain ()
#16 0x0000000103545b4d in ?? ()
#17 0x0000000100140c94 in rb_vm_dispatch ()
#18 0x0000000103543fe0 in ?? ()
#19 0x00000001035437f3 in ?? ()
#20 0x000000010014ec08 in rb_vm_run ()
#21 0x0000000100040650 in ruby_run_node ()
#22 0x000000010014f06d in macruby_main ()
#23 0x0000000100000efe in main (argc=1, argv=0x7fff5fbff640)
(gdb) p (void)rb_symbolicate(0x000000010354cf40)
addr 0x10354cf40 start 0x10354cf00 selector l2capChannelData:data:length:
location :0
$1 = void
}}}
If you like I can actually simplify my project and post that for you. Do
you have a Wiimote handy? That's the device I'm connecting to and you'll
need it to run the code and cause the error. Let me know.
The class in question is simply defined as:
{{{
class WiiRemote
def connectTo device
return false if device.nil?
@wiiDevice = device
@cchan =
openL2CAPChannelWithPSM(KBluetoothL2CAPPSMHIDControl, delegate:self)
return kIOReturnNotOpen unless @cchan
sleep 0.02
@ichan =
openL2CAPChannelWithPSM(KBluetoothL2CAPPSMHIDInterrupt, delegate:self)
return kIOReturnNotOpen unless @ichan
sleep 0.02
# Poll the device to get its current status
result = getCurrentStatus
sleep (0.01)
if (result == KIOReturnSuccess) && available
@disconnectNotification =
@wiiDevice.registerForDisconnectNotification(self,
selector:'disconnected:fromDevice:'.to_sym)
@opened = true
else
@opened = false
closeConnection
end
result
end
... SOME OTHER METHODS ...
def openL2CAPChannelWithPSM(psm, delegate:delegate)
channel = Pointer.new_with_type("@")
if (@wiiDevice.openL2CAPChannelSync(channel, withPSM:psm,
delegate:delegate) != KIOReturnSuccess)
closeConnection
return nil
end
channel[0]
end
def l2capChannelReconfigured l2capChannel
puts "l2capChannelReconfigured"
end
def l2capChannelWriteComplete l2capChannel, refcon:refcon,
status:error
puts "l2capChannelWriteComplete"
end
def l2capChannelQueueSpaceAvailable l2capChannel
puts "l2capChannelQueueSpaceAvailable"
end
def l2capChannelOpenComplete l2capChannel, status:error
puts "l2capChannelOpenComplete"
end
def l2capChannelClosed l2capChannel
puts "l2capChannelClosed"
end
def l2capChannelData l2capChannel, data:data, length:dataLength
puts "l2capChannelData"
end
end
--
Ticket URL: <http://www.macruby.org/trac/ticket/876#comment:10>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list