remove_event_detect() may produce a memory access error - system exit
A Python module to control the GPIO on a Raspberry Pi
Brought to you by:
croston
After ramping up and running a GPIO pin in input direction and using interrupts, the sutdown procedure terminates abruptly when calling move_event_detect() with nothing more than "Memory access error" ("Speicherzugriffsfehler") written on the console.
I suggests focussing on py_gpio.c#py_remove_event_detect() around line #760. It seems as if the callback memory structures are free'd (in line #767) way before actually muting the interrupt through a call of remove_edge_detect() (in line #777). If an interrupt happens to occur right in between, the remaining code may refer to memory, that is actually released, already.