[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: KJS crashes
From: Peter Kelly <pmk () post ! com>
Date: 2001-07-31 13:28:11
[Download RAW message or body]
This patch should fix the problem.
--
Peter Kelly
pmk@post.com
Antti Koivisto wrote:
> I have seen this kind of crash several times now. It's seems random and not
> reproductable.
>
>
> antti
>
> 0x40dbf019 in __wait4 () from /lib/libc.so.6
> #0 0x40dbf019 in __wait4 () from /lib/libc.so.6
> #1 0x40e1c718 in __DTOR_END__ () from /lib/libc.so.6
> #2 0x405ea495 in KCrash::defaultCrashHandler ()
> from /opt/kde/lib/libkdecore.so.3
> #3 0x40d5c9e8 in __restore ()
> at ../sysdeps/unix/sysv/linux/i386/sigaction.c:127
> #4 0x415bbb69 in KJS::Collector::allocate () from /opt/kde/lib/libkjs.so.1
> #5 0x415a7d2f in KJS::Imp::operator new () from /opt/kde/lib/libkjs.so.1
> #6 0x415abe73 in KJS::Number::Number () from /opt/kde/lib/libkjs.so.1
> #7 0x415b8e96 in KJS::NumberPrototype::NumberPrototype ()
> from /opt/kde/lib/libkjs.so.1
> #8 0x415b01d2 in KJS::GlobalImp::GlobalImp () from /opt/kde/lib/libkjs.so.1
> #9 0x415afe52 in KJS::Global::init () from /opt/kde/lib/libkjs.so.1
> #10 0x415aea34 in KJS::KJScriptImp::init () from /opt/kde/lib/libkjs.so.1
> #11 0x41599d79 in KJScript::KJScript () from /opt/kde/lib/libkjs.so.1
> #12 0x41532006 in kjs_create () from /opt/kde/lib/kde2/kjs_html.so
> #13 0x41531f61 in kjs_html_init () from /opt/kde/lib/kde2/kjs_html.so
> #14 0x4111eb5d in KHTMLPart::jScript () from /opt/kde/lib/libkhtml.so.3
> #15 0x4111ec01 in KHTMLPart::executeScript () from /opt/kde/lib/libkhtml.so.3
> #16 0x4111ebc3 in KHTMLPart::executeScript () from /opt/kde/lib/libkhtml.so.3
> #17 0x41172429 in HTMLTokenizer::parseListing ()
> from /opt/kde/lib/libkhtml.so.3
> #18 0x41172a23 in HTMLTokenizer::parseScript () from
> /opt/kde/lib/libkhtml.so.3
> #19 0x411756c8 in HTMLTokenizer::write () from /opt/kde/lib/libkhtml.so.3
>
>
["kjs_crash.diff" (text/plain)]
? kjs.kdevprj
Index: collector.cpp
===================================================================
RCS file: /home/kde/kdelibs/kjs/collector.cpp,v
retrieving revision 1.18
diff -u -p -r1.18 collector.cpp
--- collector.cpp 2001/07/28 15:15:51 1.18
+++ collector.cpp 2001/07/31 13:07:02
@@ -162,7 +162,7 @@ void Collector::collect()
Imp **r = (Imp**)block->mem;
assert(r);
for (int i = 0; i < block->size; i++, r++)
- if (*r && ((*r)->refcount || !(*r)->gcAllowed()) && !(*r)->marked())
+ if (*r && (*r)->created() && ((*r)->refcount || !(*r)->gcAllowed()) && !(*r)->marked())
(*r)->mark();
block = block->next;
}
Index: object.cpp
===================================================================
RCS file: /home/kde/kdelibs/kjs/object.cpp,v
retrieving revision 1.61
diff -u -p -r1.61 object.cpp
--- object.cpp 2001/07/28 15:15:51 1.61
+++ object.cpp 2001/07/31 13:07:12
@@ -567,6 +567,7 @@ int List::count = 0;
Imp::Imp()
: refcount(0), prop(0), proto(0)
{
+ setCreated(true);
#ifdef KJS_DEBUG_MEM
count++;
#endif
@@ -895,12 +896,24 @@ void Imp::setMarked(bool m)
void Imp::setGcAllowed(bool a)
{
- next = a ? this : 0L;
+ next = this;
+ if (a)
+ next++;
}
bool Imp::gcAllowed() const
{
- return next;
+ return (next && next != this);
+}
+
+void Imp::setCreated(bool c)
+{
+ next = c ? this : 0L;
+}
+
+bool Imp::created() const
+{
+ return next;
}
ObjectImp::ObjectImp(Class c) : cl(c), val(0L) { }
Index: object.h
===================================================================
RCS file: /home/kde/kdelibs/kjs/object.h,v
retrieving revision 1.50
diff -u -p -r1.50 object.h
--- object.h 2001/07/28 15:15:51 1.50
+++ object.h 2001/07/31 13:07:18
@@ -461,7 +461,7 @@ namespace KJS {
static const TypeInfo info;
// reserved for memory managment - currently used as flags for garbage collection
- // (prev != 0) = marked, (next != 0) = gc allowed
+ // (prev != 0) = marked, (next != 0) = created, (next != this) = created and gc allowed
Imp *prev, *next;
// for future extensions
class ImpInternal;
@@ -470,6 +470,8 @@ namespace KJS {
void setMarked(bool m);
void setGcAllowed(bool a);
bool gcAllowed() const;
+ void setCreated(bool c);
+ bool created() const;
};
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic