mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 05:20:05 +00:00
Fixed stack issue with lEvents
This commit is contained in:
parent
a29de394ee
commit
aa3dacc84b
@ -189,6 +189,11 @@ public:
|
|||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case EVENT_CALLBACK: {
|
case EVENT_CALLBACK: {
|
||||||
// make thread for this callback
|
// make thread for this callback
|
||||||
|
if (!lua_checkstack(event->state, 1)) {
|
||||||
|
std::cout << "[FATAL] Failed to create new lua thread! out of memory!" << std::endl;
|
||||||
|
terminate(0);
|
||||||
|
}
|
||||||
|
|
||||||
lua_State *nThread = lua_newthread(event->state);
|
lua_State *nThread = lua_newthread(event->state);
|
||||||
|
|
||||||
// push the callable first, the push all the arguments
|
// push the callable first, the push all the arguments
|
||||||
@ -197,9 +202,6 @@ public:
|
|||||||
|
|
||||||
// then call it :)
|
// then call it :)
|
||||||
yieldCall(nThread, nargs);
|
yieldCall(nThread, nargs);
|
||||||
|
|
||||||
// we can safely pop the thread off the stack now
|
|
||||||
lua_pop(event->state, 1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EVENT_WAIT: {
|
case EVENT_WAIT: {
|
||||||
|
Loading…
Reference in New Issue
Block a user