void-packages/srcpkgs/onboard/patches/thread-state.patch

38 lines
1.1 KiB
Diff

--- a/Onboard/osk/osk_devices.c
+++ b/Onboard/osk/osk_devices.c
@@ -97,13 +97,15 @@ osk_device_event_dealloc (OskDeviceEvent
static OskDeviceEvent*
new_device_event (void)
{
- OskDeviceEvent *ev = PyObject_New(OskDeviceEvent, &osk_device_event_type);
+ OskDeviceEvent *ev;
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ ev = PyObject_New(OskDeviceEvent, &osk_device_event_type);
if (ev)
{
osk_device_event_type.tp_init((PyObject*) ev, NULL, NULL);
- return ev;
}
- return NULL;
+ PyGILState_Release(gstate);
+ return ev;
}
static PyObject *
@@ -334,6 +336,7 @@ osk_devices_dealloc (OskDevices *dev)
static void
queue_event (OskDevices* dev, OskDeviceEvent* event, Bool discard_pending)
{
+ PyGILState_STATE state = PyGILState_Ensure ();
GQueue* queue = dev->event_queue;
if (queue)
{
@@ -364,6 +367,7 @@ queue_event (OskDevices* dev, OskDeviceE
Py_INCREF(event);
g_queue_push_head(queue, event);
}
+ PyGILState_Release (state);
}
static gboolean idle_process_event_queue (OskDevices* dev)