Éjjeli Őrjárat | 6 May 11:12

Unix wxListCtrl error

Hi all!
I am developing an application, which uses wxLUA and LUA-AIO for multithreading. I fill a wxListCtrl in it, but on Unix (on Windows no!) it causes a crash with these errors: http://dcpp.hu/images/error.png I don't know if it's wxLUA or LUA-AIO or rather Unix x11 related.. If I click to an another tab, it fills about 300 elements, but then the whole application freezes. I hope somebody can help me...
Best regards:
Attila Pazmandi

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
wxlua-users mailing list
wxlua-users@...
https://lists.sourceforge.net/lists/listinfo/wxlua-users
John Labenski | 13 May 06:10

Re: Unix wxListCtrl error

On Tue, May 6, 2008 at 5:16 AM, Éjjeli Őrjárat <ejjeliorjarat <at> gmail.com> wrote:
> Hi all!
> I am developing an application, which uses wxLUA and LUA-AIO for
> multithreading. I fill a wxListCtrl in it, but on Unix (on Windows no!) it
> causes a crash with these errors: http://dcpp.hu/images/error.png I don't
> know if it's wxLUA or LUA-AIO or rather Unix x11 related.. If I click to an
> another tab, it fills about 300 elements, but then the whole application
> freezes. I hope somebody can help me...

You cannot create or modify GUI elements from any other thread than
the main one. This is a restriction of both the GTK and MSW gui libs
that wxWidgets wraps.

I have not used LUA-AIO, but if you can send a signal to the main
thread to update the GUI that could work. This is typically done by
calling wxEvtHandler::AddPendingEvent(wxEvent). Note that wxWindow is
derived from the wxEvtHandler class so you can use the main wxFrame to
handle these delayed messages. The wxEvent you send will be some
"fake" event, maybe a generic wxCommandEvent of type
wxEVT_COMMAND_BUTTON_CLICKED (or whatever) with a unique id and
perhaps the command you want to implement as the string member.

Hope this helps,
    John
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Éjjeli Őrjárat | 13 May 11:03

Re: Unix wxListCtrl error

I posted this error on the lua-aio's forum too, and the developer told me the same. So, what I did is this: (example)
["$To:"] = function()
        local _,_,nick,msg = data:find("^%$To:%s%S+%sFrom:%s%S+%s%$<(%S+)>%s(.+)$")
        collectgarbage("collect")
        local evt = wx.wxCommandEvent(wx.wxEVT_NULL,tCtrls["wxID_POSTEVENT"])
        evt:SetString(nick.."|"..msg:gsub("&#124;","|"):gsub("&#36;","$"))
        wx.wxPostEvent(tCtrls["app"],evt) -- Send the event to the main thread
 end,
This function is parsing the incoming data from the socket. This one works well. So, I've rewritten all these parsing functions, and all use this way, but it still freeze.
LUA-A-I-O is the LUA standalone, with some added functions:
- OnError() function to catch errors
- ThreadCreate() and ThreadDestroy() functions for multithreading
- ThreadNewMutex(), ThreadLockMutex() and ThreadUnlockMutex() for mutexes
The TCP socket listens on a new thread, so I've sent back the incoming data for parsing to the main thread now, but I still get this error. Any other idea? Maybe I did something wrong? Thanks in advance

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxlua-users mailing list
wxlua-users@...
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Gmane