Ticket #78 (closed defect: fixed)
Stub patch for cleanup checks in python bindings
| Reported by: | insomniac | Owned by: | dsmith |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | other | Version: | |
| Keywords: | Cc: |
Description
I'm absolutely new to cwiid. I downloaded it for the first time a couple of hourse ago, so I don't know if I'm acting the right way. Anyway, I tried a sequence of commands like this:
$ python Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import cwiid wiimote = cwiid.Wiimote() wiimote.led = 1 wiimote.close() wiimote.led = 1
Segmentation fault
Looking at the code in the python/ directory, I see that there's no check on the self->wiimote pointer whether it's NULL or not. I think the correct approach would be to raise an exception, but I'm not familiar with Python bindings, so I wrote a small patch that just returns NULL in case the self->wiimote is NULL. A more experienced programmer may replace the "return NULL" with something better.
The patch is located at http://insomniac.slackware.it/download/cwiid-0.6.00.self-wiimote.patch and also attached to the ticket.
Best regards, Andrea Barberio
