[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: kjs bug (onSubmit related)
From:       Harri Porten <porten () trolltech ! com>
Date:       2001-07-28 14:45:59
[Download RAW message or body]

On Thu, 26 Jul 2001, Michael Bayne wrote:

> I think that KJScriptImp::call probably wants to stuff that return value
> into it's local return value reference, which the following diff
> accomplishes:

Right. Well spotted.

> Index: internal.cpp
> ===================================================================
> RCS file: /home/kde/kdelibs/kjs/internal.cpp,v
> retrieving revision 1.79
> diff -u -p -r1.79 internal.cpp
> --- internal.cpp        2001/07/23 18:17:54     1.79
> +++ internal.cpp        2001/07/26 21:13:29
> @@ -760,9 +760,12 @@ bool KJScriptImp::call(const KJSO &func,
> 
>    running++;
>    recursion++;
> -  func.executeCall(thisV, &args, &extraScope);
> +  KJSO res = func.executeCall(thisV, &args, &extraScope);
>    recursion--;
>    running--;
> +
> +  // keep track of the return value
> +  retVal = res.imp();
> 
>    return !hadException();
>  }

I guess you don't mind if we shorten this to:

-  func.executeCall(thisV, &args, &extraScope);
+  retVal = func.executeCall(thisV, &args, &extraScope).imp();

?

> I've applied this and it seems to do the right thing, but I don't know
> much about reference counting KJSO instances and all that, so perhaps
> something more sophisticated needs be done.

That's indeed an interesting question. I left KJScriptImp members as Imp*
because of speed reason. But after Peter's new gc patch we might have to
change that. Peter ?

> In any event, hopefully porten or pmk are reading this since they seem to
> be the ones that do the most work on the kjs and ECMA stuff.

We are. And I have to say that I am happy to see people finding & fixing
such bugs by themselves. Thanks a lot. I can imagine that the code is
probably hard to read and understand. Feel free to ask for help or source
code comment wheenver needed.

Harri.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic