SourceForge logo
SourceForge logo
Menu

wxlua-users

From: É. Ő. <ejj...@gm...> - 2008年05月06日 09:16:36
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
From: John L. <jla...@gm...> - 2008年05月13日 04:10:48
On Tue, May 6, 2008 at 5:16 AM, Éjjeli Őrjárat <ejj...@gm...> 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
From: É. Ő. <ejj...@gm...> - 2008年05月13日 09:03:20
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
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /