From: Javier Mr <jav...@ym...> - 2013-04-12 20:13:17
|
Hi, i'm using wxLua to make an interface, but i'm facing several crashed and after looking for the source of them i could find it. I have an idea of a posible reason so i will ask in case this is a known behaviour. First several questions? 1. First in wxWidgets, are events (click, cell changes, tree item activation, etc...) dispatched synchronously or asynchronously? 2. If asynchronously, could it be posible that to events are dispatcher against the same lua state simultaneaously?. What i have is a tree control with several items and a grid, so when a item in the tree is activated the grid is filled up. I'm currently connected to events for tree item activation, tree item right click, grid cell changed. Let's suppose the wxWidget thread running on the main loop is A ( 3. which i belive is the thread that load the lua script, isn't it? ), when i activate a tree node a event (evt1) will be queued in the event queue (4. isn't it?), and the main loop will check for pending events it will find the event (evt1) and will dispatch it (5. but will the lua function from the event handler be called by the thread running the main loop (A) or will a second thread be created (B) ?). In case question 5 is that a new thread will be created for executing the handler, could another event in the tree (evt2) be queued in the events queue and then the main loop thread (A) dispatch it creating a new thread (C) **accesing** and modifiying the lua state while the previous event thread (B) hasn't return yet? My hole test so far have been repainting the grid while clicking several timer over a tree item so the event handler doesn't return inmediatly. I think all previous questions could be summariazed but, does wxLua protect the access to the lua state from within wxLua? Thanks in advance. Best regards. Javi. Note: I will post the same question on StackOverflow, just letting you know. I will copy the solution from one to another. |