[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:39:39 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit baf1b61c0ba6a39be91ddef5c67330710ab5ec65
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 18 05:12:48 2002 +0000

    	- fixed 3025022 -- Crash in KWQKHTMLPartImpl::redirectionTimerStartedOrStopped()
    
            * kwq/WebCoreBridge.mm: (-[WebCoreBridge dealloc]): Set the bridge on the part to
    	nil just in case someone else is holding a reference, so we won't try to dispatch
    	methods to an already-deallocated bridge.
    
    	- fixed 3028476 -- illegal instruction crash in KWQTimerCallback timerFired
    
            * khtml/ecma/kjs_window.cpp: (WindowQObject::parentDestroyed):
    	Remove APPLE_CHANGES to avoid calling killTimers(); we can call it
    	now that we have a working implementation.
            * khtml/khtmlview.cpp:
            (KHTMLView::~KHTMLView): Remove APPLE_CHANGES that kills timers.
    	All timers are killed by ~QObject now, just as in Qt.
            (KHTMLView::clear): Remove APPLE_CHANGES to avoid calling killTimers();
    	we can call it now that we have a working implementation.
    
            * kwq/KWQObject.mm:
            (QObject::~QObject): Call killTimers().
            (QObject::startTimer): Keep a dictionary keyed by QObject, with a dictionary
    	of timers for each, rather than one global dictionary. This makes it efficient
    	to kill all the timers for an object.
            (QObject::killTimer): Update for new level of dictionary.
            (QObject::killTimers): Kill all the timers in this object's timer dictionary
    	rather than all timers in the world.
            (QObject::inherits): Add an ERROR for the case where the class name is unknown.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2080 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 177ac56..bfa9e61 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,34 @@
 2002-09-17  Darin Adler  <darin at apple.com>
 
+	- fixed 3025022 -- Crash in KWQKHTMLPartImpl::redirectionTimerStartedOrStopped()
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge dealloc]): Set the bridge on the part to
+	nil just in case someone else is holding a reference, so we won't try to dispatch
+	methods to an already-deallocated bridge.
+
+	- fixed 3028476 -- illegal instruction crash in KWQTimerCallback timerFired
+
+        * khtml/ecma/kjs_window.cpp: (WindowQObject::parentDestroyed):
+	Remove APPLE_CHANGES to avoid calling killTimers(); we can call it
+	now that we have a working implementation.
+        * khtml/khtmlview.cpp:
+        (KHTMLView::~KHTMLView): Remove APPLE_CHANGES that kills timers.
+	All timers are killed by ~QObject now, just as in Qt.
+        (KHTMLView::clear): Remove APPLE_CHANGES to avoid calling killTimers();
+	we can call it now that we have a working implementation.
+
+        * kwq/KWQObject.mm:
+        (QObject::~QObject): Call killTimers().
+        (QObject::startTimer): Keep a dictionary keyed by QObject, with a dictionary
+	of timers for each, rather than one global dictionary. This makes it efficient
+	to kill all the timers for an object.
+        (QObject::killTimer): Update for new level of dictionary.
+        (QObject::killTimers): Kill all the timers in this object's timer dictionary
+	rather than all timers in the world.
+        (QObject::inherits): Add an ERROR for the case where the class name is unknown.
+
+2002-09-17  Darin Adler  <darin at apple.com>
+
 	- fixed 3050818 -- Crash in relative-KURL constructor at site with _ in host name
 
         * kwq/KWQKURL.mm: Change _ so that it's allowed in host names.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 177ac56..bfa9e61 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,34 @@
 2002-09-17  Darin Adler  <darin at apple.com>
 
+	- fixed 3025022 -- Crash in KWQKHTMLPartImpl::redirectionTimerStartedOrStopped()
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge dealloc]): Set the bridge on the part to
+	nil just in case someone else is holding a reference, so we won't try to dispatch
+	methods to an already-deallocated bridge.
+
+	- fixed 3028476 -- illegal instruction crash in KWQTimerCallback timerFired
+
+        * khtml/ecma/kjs_window.cpp: (WindowQObject::parentDestroyed):
+	Remove APPLE_CHANGES to avoid calling killTimers(); we can call it
+	now that we have a working implementation.
+        * khtml/khtmlview.cpp:
+        (KHTMLView::~KHTMLView): Remove APPLE_CHANGES that kills timers.
+	All timers are killed by ~QObject now, just as in Qt.
+        (KHTMLView::clear): Remove APPLE_CHANGES to avoid calling killTimers();
+	we can call it now that we have a working implementation.
+
+        * kwq/KWQObject.mm:
+        (QObject::~QObject): Call killTimers().
+        (QObject::startTimer): Keep a dictionary keyed by QObject, with a dictionary
+	of timers for each, rather than one global dictionary. This makes it efficient
+	to kill all the timers for an object.
+        (QObject::killTimer): Update for new level of dictionary.
+        (QObject::killTimers): Kill all the timers in this object's timer dictionary
+	rather than all timers in the world.
+        (QObject::inherits): Add an ERROR for the case where the class name is unknown.
+
+2002-09-17  Darin Adler  <darin at apple.com>
+
 	- fixed 3050818 -- Crash in relative-KURL constructor at site with _ in host name
 
         * kwq/KWQKURL.mm: Change _ so that it's allowed in host names.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 177ac56..bfa9e61 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,34 @@
 2002-09-17  Darin Adler  <darin at apple.com>
 
+	- fixed 3025022 -- Crash in KWQKHTMLPartImpl::redirectionTimerStartedOrStopped()
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge dealloc]): Set the bridge on the part to
+	nil just in case someone else is holding a reference, so we won't try to dispatch
+	methods to an already-deallocated bridge.
+
+	- fixed 3028476 -- illegal instruction crash in KWQTimerCallback timerFired
+
+        * khtml/ecma/kjs_window.cpp: (WindowQObject::parentDestroyed):
+	Remove APPLE_CHANGES to avoid calling killTimers(); we can call it
+	now that we have a working implementation.
+        * khtml/khtmlview.cpp:
+        (KHTMLView::~KHTMLView): Remove APPLE_CHANGES that kills timers.
+	All timers are killed by ~QObject now, just as in Qt.
+        (KHTMLView::clear): Remove APPLE_CHANGES to avoid calling killTimers();
+	we can call it now that we have a working implementation.
+
+        * kwq/KWQObject.mm:
+        (QObject::~QObject): Call killTimers().
+        (QObject::startTimer): Keep a dictionary keyed by QObject, with a dictionary
+	of timers for each, rather than one global dictionary. This makes it efficient
+	to kill all the timers for an object.
+        (QObject::killTimer): Update for new level of dictionary.
+        (QObject::killTimers): Kill all the timers in this object's timer dictionary
+	rather than all timers in the world.
+        (QObject::inherits): Add an ERROR for the case where the class name is unknown.
+
+2002-09-17  Darin Adler  <darin at apple.com>
+
 	- fixed 3050818 -- Crash in relative-KURL constructor at site with _ in host name
 
         * kwq/KWQKURL.mm: Change _ so that it's allowed in host names.
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index 4c52bf6..d33e117 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -1397,14 +1397,7 @@ WindowQObject::~WindowQObject()
 void WindowQObject::parentDestroyed()
 {
   //kdDebug(6070) << "WindowQObject::parentDestroyed " << this << " we have " << scheduledActions.count() << " actions in the map" << endl;
-#ifdef APPLE_CHANGES
-  QMapIterator<int,ScheduledAction*> myit;
-  for (myit = scheduledActions.begin(); myit != scheduledActions.end(); ++myit) {
-    killTimer(myit.key());
-  }
-#else
   killTimers();
-#endif
   QMapIterator<int,ScheduledAction*> it;
   for (it = scheduledActions.begin(); it != scheduledActions.end(); ++it) {
     ScheduledAction *action = *it;
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index c43a9c8..18b6eeb 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -245,13 +245,6 @@ KHTMLView::~KHTMLView()
 #endif
     }
 
-#ifdef APPLE_CHANGES
-    killTimer(d->timerId);
-    killTimer(d->repaintTimerId);
-    d->timerId = 0;
-    d->repaintTimerId = 0;
-#endif
-
     delete d; d = 0;
 }
 
@@ -284,14 +277,7 @@ void KHTMLView::clear()
     setStaticBackground(true);
 
     d->reset();
-#ifdef APPLE_CHANGES
-    killTimer(d->timerId);
-    killTimer(d->repaintTimerId);
-    d->timerId = 0;
-    d->repaintTimerId = 0;
-#else
     killTimers();
-#endif
     emit cleared();
 
     QScrollView::setHScrollBarMode(d->hmode);
diff --git a/WebCore/kwq/KWQObject.mm b/WebCore/kwq/KWQObject.mm
index 490ab6d..a3847ff 100644
--- a/WebCore/kwq/KWQObject.mm
+++ b/WebCore/kwq/KWQObject.mm
@@ -33,6 +33,19 @@
 
 const QObject *QObject::m_sender;
 
+static CFMutableDictionaryRef timerDictionaries;
+
+ at interface KWQObjectTimerTarget : NSObject
+{
+    QObject *target;
+    int timerId;
+}
+
+- initWithQObject:(QObject *)object timerId:(int)timerId;
+- (void)timerFired;
+
+ at end
+
 KWQSignal *QObject::findSignal(const char *signalName) const
 {
     for (KWQSignal *signal = m_signalListHead; signal; signal = signal->m_next) {
@@ -109,92 +122,100 @@ QObject::QObject(QObject *parent, const char *name)
 QObject::~QObject()
 {
     ASSERT(m_signalListHead == 0);
+    killTimers();
 }
 
- at interface KWQTimerCallback : NSObject
-{
-    QObject *target;
-    int timerId;
-}
-- initWithQObject: (QObject *)object timerId: (int)timerId;
-- (void)timerFired: (id)context;
- at end
-
- at implementation KWQTimerCallback
-- initWithQObject: (QObject *)qo timerId: (int)t
-{
-    [super init];
-    timerId = t;
-    target = qo;
-    return self;
-}
-
-- (void)timerFired: (id)context
+void QObject::timerEvent(QTimerEvent *te)
 {
-    QTimerEvent te(timerId);
-    target->timerEvent (&te);
 }
- at end
-
-static NSMutableDictionary *timers;
 
-void QObject::timerEvent(QTimerEvent *te)
+bool QObject::event(QEvent *)
 {
+    return false;
 }
 
 int QObject::startTimer(int milliseconds)
 {
     static int timerCount = 1;
 
-    NSNumber *timerId = [NSNumber numberWithInt: timerCount];
+    if (timerDictionaries == NULL) {
+        // The global timers dictionary itself leaks, but the contents are removed
+        // when each timer fires or is killed.
+        timerDictionaries = CFDictionaryCreateMutable(NULL, 0, NULL, &kCFTypeDictionaryValueCallBacks);
+    }
     
+    NSMutableDictionary *timers = (NSMutableDictionary *)CFDictionaryGetValue(timerDictionaries, this);
     if (timers == nil) {
-        // The global timers dictionary itself leaks, but the contents are removed
-        // when a timer expires or is killed.
         timers = [[NSMutableDictionary alloc] init];
+        CFDictionarySetValue(timerDictionaries, this, timers);
+        [timers release];
     }
-    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval: ((NSTimeInterval)milliseconds)/1000
-                target: [[[KWQTimerCallback alloc] initWithQObject: this timerId: timerCount] autorelease]
-                selector: @selector(timerFired:)
-                userInfo: timerId
-                repeats: NO];
-    [timers setObject: timer forKey: timerId];
-        
+
+    NSNumber *timerId = [NSNumber numberWithInt:timerCount];
+    KWQObjectTimerTarget *target = [[KWQObjectTimerTarget alloc] initWithQObject:this timerId:timerCount];
+    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:milliseconds / 1000.0
+          target:target
+        selector:@selector(timerFired)
+        userInfo:target
+         repeats:NO];
+    [target release];
+    [timers setObject:timer forKey:timerId];
+    
     return timerCount++;    
 }
 
 void QObject::killTimer(int _timerId)
 {
-    NSNumber *timerId = [NSNumber numberWithInt: _timerId];
-    NSTimer *timer;
-    
-    timer = (NSTimer *)[timers objectForKey: timerId];
+    if (_timerId == 0) {
+        return;
+    }
+    if (timerDictionaries == NULL) {
+        return;
+    }
+    NSMutableDictionary *timers = (NSMutableDictionary *)CFDictionaryGetValue(timerDictionaries, this);
+    NSNumber *timerId = [NSNumber numberWithInt:_timerId];
+    NSTimer *timer = (NSTimer *)[timers objectForKey:timerId];
     [timer invalidate];
-    [timers removeObjectForKey: timerId];
+    [timers removeObjectForKey:timerId];
 }
 
 void QObject::killTimers()
 {
-    NSArray *contexts;
-    NSNumber *key;
-    NSTimer *timer;
-    int i, count;
-    
-    contexts = [timers allKeys];
-    count = [contexts count];
-    for (i = 0; i < count; i++){
-        key = (NSNumber *)[contexts objectAtIndex: i];
-        timer = (NSTimer *)[timers objectForKey: key];
+    if (timerDictionaries == NULL) {
+        return;
+    }
+    NSMutableDictionary *timers = (NSMutableDictionary *)CFDictionaryGetValue(timerDictionaries, this);
+    if (timers == nil) {
+        return;
+    }
+    NSArray *keys = [timers allKeys];
+    int count = [keys count];
+    for (int i = 0; i < count; i++) {
+        NSNumber *key = (NSNumber *)[keys objectAtIndex:i];
+        NSTimer *timer = (NSTimer *)[timers objectForKey:key];
         [timer invalidate];
-        [timers removeObjectForKey: key];
     }
+    CFDictionaryRemoveValue(timerDictionaries, this);
 }
 
-bool QObject::event(QEvent *)
+ at implementation KWQObjectTimerTarget
+
+- initWithQObject:(QObject *)qo timerId:(int)t
 {
-    return false;
+    [super init];
+    target = qo;
+    timerId = t;
+    return self;
 }
 
+- (void)timerFired
+{
+    QTimerEvent event(timerId);
+    target->timerEvent(&event);
+}
+
+ at end
+
 // special includes only for inherits
 
 #import <khtml_part.h>
@@ -220,6 +241,6 @@ bool QObject::inherits(const char *className) const
     if (strcmp(className, "QScrollView") == 0) {
         return dynamic_cast<const QScrollView *>(this);
     }
-    // FIXME: ERROR here because we don't know the class name.
+    ERROR("class name %s not recognized", className);
     return false;
 }
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 403b748..646446a 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -70,6 +70,7 @@ using khtml::RenderPart;
     if (renderPart) {
         renderPart->deref();
     }
+    part->impl->setBridge(nil);
     part->deref();
     
     [super dealloc];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list