[elinks-users] garbled error messages

Miciah Dashiel Butler Masters miciah at myrealbox.com
Fri May 6 16:31:39 PDT 2005


On Fri, May 06, 2005 at 09:15:13PM +0200, Jonas Fonseca wrote:
> Jon Shapcott <eden at xibalba.demon.co.uk> wrote Fri, May 06, 2005:
> > On Fri, May 06, 2005 at 08:47:47PM +0200, Jonas Fonseca wrote:
> > > Miciah Dashiel Butler Masters <miciah at myrealbox.com> wrote Fri, May 06, 2005:
> > > > -               info_box(errterm, MSGBOX_NO_TEXT_INTL,
> > > > +               info_box(errterm, MSGBOX_NO_TEXT_INTL, MSGBOX_FREE_TEXT,
> > > 
> > >                                     MSGBOX_NO_TEXT_INTL | MSGBOX_FREE_TEXT,
> > > 
> > > The two MSGBOX flags should be ORed together.

It isn't like I had time to test it or anything.


> > I figured that out when the compiler complained at me. Long time since I've
> > hacked C, but those idioms still stick in the mind.
> >
> > Copying the string and telling the dialog to free it worked for me.
> 
> Great! :)
> 
> Miciah, will you commit the fix? Looks like 0.10 is also affected.

I'll do it for both HEAD and 0.10.

> > Although I'm still a little puzzled as to why it suddenly started. It
> > was doing the same thing for both alert_lua_error and
> > alert_lua_error2, even with the extra copying going on in
> > alert_lua_error2.

It could be that you were observing the problem when we passed in
a string that came from Lua. Newer Lua versions might overwrite
the memory sooner, or maybe the Lua code was changed in such a way
that the string is collected sooner.

As for alert_lua_error2, note that it frees the string after passing it
to alert_lua_error. Due to ELinks' asynchronous nature, this means that
it will free the string while ELinks is displaying it.

> The Lua C code has not gotten so much attention lately. But I agree this
> is a bit stupid.
> 
> > Thanks a lot for the help. I should return the favour, and maybe hack some
> > on the unstable version. Both core.c and hooks.c get quite a lot shorter
> > when you turn the cut'n'paste into functions, a drop some of the arcane
> > passing of the global lua_State in and out of dialog events.

Cut and paste? Arcana? I'd love to know more.

> Don't mind if you do. ;)
> 
> > Now to get those function references into the lua 5 api ...
> 
> Huh?

Ditto Jonas.

-- 
Miciah Masters <miciah at myrealbox.com> / <mdm0304 at mail.ecu.edu>



More information about the elinks-users mailing list