Regarding Konqueror JavaScript memory leak (bug #44697)

David Faure faure at kde.org
Thu Nov 21 09:52:15 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 21 November 2002 02:11, Dirk Mueller wrote:
> -  globalObject.put(m_script->globalExec(),
> -                  "debug", Value(new TestFunctionImp()), Internal);
> +    globalObject.put(m_script->globalExec(),
> +                    "   debug", Value(new TestFunctionImp()), Internal);

One mistake here - the leading spaces before "debug".

I also think that calling applyUserAgent from each initScript() call is wrong.
initScript() is called from many many methods in KJSProxyImpl,
(it's a simple "build on demand" pattern), it shouldn't call applyUserAgent every time.

What was the problem with calling applyUserAgent() from clear()? The case
where the part has been deleted, right?
Then KJSProxyImpl::m_part should be a QGuardedPtr (like the one in Window),
or we could simply use the part that's stored in the Window:

- --- kjs_proxy.cpp       2002/11/12 16:37:46     1.85
+++ kjs_proxy.cpp       2002/11/21 09:50:37
@@ -200,9 +200,9 @@ void KJSProxyImpl::clear() {
         // re-add "debug", clear() removed it
         m_script->globalObject().put(m_script->globalExec(),
                                      "debug", Value(new TestFunctionImp()), Internal);
+        if ( !win->part().isNull() )
+            applyUserAgent();
     }
- -
- -    applyUserAgent();
   }
 }

(OK, that one is a bit obscure, because it means m_part is still a dangling 
pointer during the clear() call. But now there's no more code using it...)

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE93KzP72KcVAmwbhARAtgNAJ4yQIB0N163rYo4Zb7Nw2KpqjzNPQCfWR/0
fZ7M3CgEMl1+zC0JePcaH7g=
=BVyL
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list