mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
fix event deinit
This commit is contained in:
parent
619b87661f
commit
0df88ba177
2
port/linux/.vscode/launch.json
vendored
2
port/linux/.vscode/launch.json
vendored
@ -20,7 +20,7 @@
|
||||
// "--gtest_filter=stddata.encode_decode"
|
||||
// "--gtest_filter=packtool.packfiles_txt"
|
||||
// "--gtest_filter=cmodule.class_attr_obj"
|
||||
"--gtest_filter=event.event_thread"
|
||||
// "--gtest_filter=event.event_thread"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
|
@ -2915,10 +2915,10 @@ Arg* obj_runMethodArg1(PikaObj* self, Arg* methodArg, Arg* arg1) {
|
||||
return pika_runFunction1_ex(self, methodArg, arg1);
|
||||
}
|
||||
|
||||
Arg* __eventListener_runEvent(PikaEventListener* lisener,
|
||||
Arg* __eventListener_runEvent(PikaEventListener* listener,
|
||||
uintptr_t eventId,
|
||||
Arg* eventData) {
|
||||
PikaObj* handler = pika_eventListener_getEventHandleObj(lisener, eventId);
|
||||
PikaObj* handler = pika_eventListener_getEventHandleObj(listener, eventId);
|
||||
pika_debug("event handler: %p", handler);
|
||||
if (NULL == handler) {
|
||||
pika_platform_printf(
|
||||
|
20
src/PikaVM.c
20
src/PikaVM.c
@ -231,7 +231,17 @@ void _VMEvent_deinit(void) {
|
||||
arg_deinit(g_PikaVMState.sq.res[i]);
|
||||
g_PikaVMState.sq.res[i] = NULL;
|
||||
}
|
||||
g_PikaVMState.cq.id[i] = 0;
|
||||
g_PikaVMState.cq.data[i].arg = NULL;
|
||||
g_PikaVMState.cq.listener[i] = NULL;
|
||||
g_PikaVMState.sq.id[i] = 0;
|
||||
g_PikaVMState.sq.data[i].signal = 0;
|
||||
g_PikaVMState.sq.listener[i] = NULL;
|
||||
}
|
||||
g_PikaVMState.cq.head = 0;
|
||||
g_PikaVMState.cq.tail = 0;
|
||||
g_PikaVMState.sq.head = 0;
|
||||
g_PikaVMState.sq.tail = 0;
|
||||
if (NULL != g_PikaVMState.event_thread) {
|
||||
g_PikaVMState.event_thread_exit = 1;
|
||||
pika_platform_thread_destroy(g_PikaVMState.event_thread);
|
||||
@ -372,22 +382,24 @@ void __VMEvent_pickupEvent(char* info) {
|
||||
if (evt_pickup_cnt >= PIKA_EVENT_PICKUP_MAX) {
|
||||
return;
|
||||
}
|
||||
PikaObj* event_lisener;
|
||||
PikaObj* event_listener;
|
||||
uintptr_t event_id;
|
||||
Arg* event_data;
|
||||
int signal;
|
||||
int head;
|
||||
if (PIKA_RES_OK == __eventListener_popEvent(&event_lisener, &event_id,
|
||||
if (PIKA_RES_OK == __eventListener_popEvent(&event_listener, &event_id,
|
||||
&event_data, &signal, &head)) {
|
||||
g_PikaVMState.event_pickup_cnt++;
|
||||
pika_debug("pickup_info: %s", info);
|
||||
pika_debug("pickup_cnt: %d", g_PikaVMState.event_pickup_cnt);
|
||||
Arg* res = NULL;
|
||||
if (NULL != event_data) {
|
||||
res = __eventListener_runEvent(event_lisener, event_id, event_data);
|
||||
res =
|
||||
__eventListener_runEvent(event_listener, event_id, event_data);
|
||||
} else {
|
||||
event_data = arg_newInt(signal);
|
||||
res = __eventListener_runEvent(event_lisener, event_id, event_data);
|
||||
res =
|
||||
__eventListener_runEvent(event_listener, event_id, event_data);
|
||||
arg_deinit(event_data);
|
||||
event_data = NULL;
|
||||
}
|
||||
|
@ -2,4 +2,4 @@
|
||||
#define PIKA_VERSION_MINOR 13
|
||||
#define PIKA_VERSION_MICRO 2
|
||||
|
||||
#define PIKA_EDIT_TIME "2024/01/12 00:04:18"
|
||||
#define PIKA_EDIT_TIME "2024/01/12 00:25:32"
|
||||
|
Loading…
x
Reference in New Issue
Block a user