[Pipmak-Devel] mouseloc() crash: Bug in loadnode?
Status: Alpha
Brought to you by:
cwalther
From: Andrea V. <and...@gm...> - 2007-07-25 07:28:24
|
Hi Christian, if you try this project: main.lua version (0.27) title "test-mouse" startnode (1) 1.lua panel { "image.png",....} posx,posy=pipmak.mouseloc() pipmak.print(posx," ",posy) Pipmak crash with access violation (this not happen with pipmak.clickloc() ) I'm investigated a little: The access violation is caused by member-method thisCNode->mouseXYtoHV which it isn't initialized as all of the methods of CNode at time of calling mouselocLua()! pipmakLuaLib.c: static int mouselocLua(lua_State *L) thisCNode->mouseXYtoHV(thisCNode, mouseX, mouseY, &h, &v); This is the calling sequence which cause te error: nodes.c: CNode *loadNode(int nodeID) ..... ..... /* at this point mouseXYtoHV isn't initialized */ call pipmak_internal.loadnode from default.lua .... default.lua: --now execution continue in lua luaDofile("node.lua") which call mouselocLua which call mouseXYtoHV -->not defined: error!!! ..... ..... /* now mouseXYtoHV is initialized but it too late!!!*/ case NODE_TYPE_PANEL: makePanelCNode(thisCNode); //this initialize mouseXYtoHV !!! ..... ..... I think it should be possible which the problem happen also with other functions... I think you have to move the initializing of methods of CNode before calling pipmak_internal.loadnode It's very interesting how you have implemented OOP in C, I never seen before! Andrea |