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

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:55:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit bcb04694b2ef870c86647c34ebaf318aaac5f7b6
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 14 19:11:31 2002 +0000

    Fixed a crash when IFPluginView were dealloced before URLHandles were complete
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@622 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/Plugins.subproj/IFPluginView.h b/WebKit/Plugins.subproj/IFPluginView.h
index 9e72f3a..eda2e5d 100644
--- a/WebKit/Plugins.subproj/IFPluginView.h
+++ b/WebKit/Plugins.subproj/IFPluginView.h
@@ -8,7 +8,7 @@
 #import <WCPlugin.h>
 #include <qwidget.h>
 #include <npapi.h>
-#include <WCURLHandle.h>
+#import <WebFoundation/WebFoundation.h>
 
 typedef struct _StreamData{
     uint16 transferMode;
@@ -43,7 +43,7 @@ typedef struct _StreamData{
             
     NSString *URL, *mime;
     NSTrackingRectTag trackingTag;
-    NSMutableArray *filesToErase;
+    NSMutableArray *filesToErase, *activeURLHandles;
     
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index b7dd617..04c810e 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -6,7 +6,7 @@
 #import "IFPluginView.h"
 #include <Carbon/Carbon.h> 
 #include "kwqdebug.h"
-
+#include <WCURLHandle.h>
 
 @implementation IFPluginViewNullEventSender
 
@@ -28,7 +28,7 @@
     event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
     acceptedEvent = NPP_HandleEvent(instance, &event);
     //KWQDebug("NPP_HandleEvent(nullEvent): %d  when: %u\n", acceptedEvent, event.when);
-    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.01];
+    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.1];
 }
 
 -(void) stop
@@ -103,7 +103,9 @@
     transferred = FALSE;
     stopped = FALSE;
     filesToErase = [NSMutableArray arrayWithCapacity:2];
+    activeURLHandles = [NSMutableArray arrayWithCapacity:1];
     [filesToErase retain];
+    [activeURLHandles retain];
     //trackingTag = [self addTrackingRect:r owner:self userData:nil assumeInside:NO];
     eventSender = [[IFPluginViewNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
     [eventSender sendNullEvents];
@@ -162,6 +164,7 @@
     NPStream *stream;
     NPError npErr;    
     uint16 transferMode;
+    IFURLHandle *urlHandle;
     
     stream = malloc(sizeof(NPStream));
     cURL   = malloc([streamURL length]+1);
@@ -184,7 +187,9 @@
     
     if(transferMode == NP_NORMAL){
         KWQDebug("Stream type: NP_NORMAL\n");
-        [WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData) loadInBackground];
+        urlHandle = (IFURLHandle *)WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData);
+        [activeURLHandles addObject:urlHandle];
+        [urlHandle loadInBackground];
     }else if(transferMode == NP_ASFILEONLY || transferMode == NP_ASFILE){
         if(transferMode == NP_ASFILEONLY) KWQDebug("Stream type: NP_ASFILEONLY\n");
         if(transferMode == NP_ASFILE) KWQDebug("Stream type: NP_ASFILE\n");
@@ -192,7 +197,9 @@
         [streamData->filename retain];
         streamData->data = [NSMutableData dataWithCapacity:0];
         [streamData->data retain];
-        [WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData) loadInBackground];
+        urlHandle = (IFURLHandle *)WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData);
+        [activeURLHandles addObject:urlHandle];
+        [urlHandle loadInBackground];
     }else if(transferMode == NP_SEEK){
         KWQDebug("Stream type: NP_SEEK not yet supported\n");
     }
@@ -255,6 +262,7 @@
     }
     [self setNeedsDisplay:YES];
     free(streamData);
+    [activeURLHandles removeObject:sender];
 }
 
 - (void)WCURLHandleResourceDidBeginLoading:(id)sender userData:(void *)userData
@@ -528,8 +536,12 @@
 - (void)stop
 {
     NPError npErr;
+    unsigned i;
     
     if (!stopped){
+        for(i=0; i<[activeURLHandles count]; i++){
+            [[activeURLHandles objectAtIndex:i] cancelLoadInBackground];
+        }
         [eventSender stop];
         [eventSender release];
         npErr = NPP_Destroy(instance, NULL);
@@ -554,6 +566,7 @@
         [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil]; 
     }
     [filesToErase release];
+    [activeURLHandles release];
     [mime release];
     [URL release];
     [plugin release];
diff --git a/WebKit/Plugins.subproj/WebPluginView.h b/WebKit/Plugins.subproj/WebPluginView.h
index 9e72f3a..eda2e5d 100644
--- a/WebKit/Plugins.subproj/WebPluginView.h
+++ b/WebKit/Plugins.subproj/WebPluginView.h
@@ -8,7 +8,7 @@
 #import <WCPlugin.h>
 #include <qwidget.h>
 #include <npapi.h>
-#include <WCURLHandle.h>
+#import <WebFoundation/WebFoundation.h>
 
 typedef struct _StreamData{
     uint16 transferMode;
@@ -43,7 +43,7 @@ typedef struct _StreamData{
             
     NSString *URL, *mime;
     NSTrackingRectTag trackingTag;
-    NSMutableArray *filesToErase;
+    NSMutableArray *filesToErase, *activeURLHandles;
     
     NPP_NewProcPtr NPP_New;
     NPP_DestroyProcPtr NPP_Destroy;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index b7dd617..04c810e 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -6,7 +6,7 @@
 #import "IFPluginView.h"
 #include <Carbon/Carbon.h> 
 #include "kwqdebug.h"
-
+#include <WCURLHandle.h>
 
 @implementation IFPluginViewNullEventSender
 
@@ -28,7 +28,7 @@
     event.when = (uint32)((double)UnsignedWideToUInt64(msecs) / 1000000 * 60); // microseconds to ticks
     acceptedEvent = NPP_HandleEvent(instance, &event);
     //KWQDebug("NPP_HandleEvent(nullEvent): %d  when: %u\n", acceptedEvent, event.when);
-    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.01];
+    [self performSelector:@selector(sendNullEvents) withObject:nil afterDelay:.1];
 }
 
 -(void) stop
@@ -103,7 +103,9 @@
     transferred = FALSE;
     stopped = FALSE;
     filesToErase = [NSMutableArray arrayWithCapacity:2];
+    activeURLHandles = [NSMutableArray arrayWithCapacity:1];
     [filesToErase retain];
+    [activeURLHandles retain];
     //trackingTag = [self addTrackingRect:r owner:self userData:nil assumeInside:NO];
     eventSender = [[IFPluginViewNullEventSender alloc] initializeWithNPP:instance functionPointer:NPP_HandleEvent];
     [eventSender sendNullEvents];
@@ -162,6 +164,7 @@
     NPStream *stream;
     NPError npErr;    
     uint16 transferMode;
+    IFURLHandle *urlHandle;
     
     stream = malloc(sizeof(NPStream));
     cURL   = malloc([streamURL length]+1);
@@ -184,7 +187,9 @@
     
     if(transferMode == NP_NORMAL){
         KWQDebug("Stream type: NP_NORMAL\n");
-        [WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData) loadInBackground];
+        urlHandle = (IFURLHandle *)WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData);
+        [activeURLHandles addObject:urlHandle];
+        [urlHandle loadInBackground];
     }else if(transferMode == NP_ASFILEONLY || transferMode == NP_ASFILE){
         if(transferMode == NP_ASFILEONLY) KWQDebug("Stream type: NP_ASFILEONLY\n");
         if(transferMode == NP_ASFILE) KWQDebug("Stream type: NP_ASFILE\n");
@@ -192,7 +197,9 @@
         [streamData->filename retain];
         streamData->data = [NSMutableData dataWithCapacity:0];
         [streamData->data retain];
-        [WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData) loadInBackground];
+        urlHandle = (IFURLHandle *)WCURLHandleCreate([NSURL URLWithString:streamURL], self, streamData);
+        [activeURLHandles addObject:urlHandle];
+        [urlHandle loadInBackground];
     }else if(transferMode == NP_SEEK){
         KWQDebug("Stream type: NP_SEEK not yet supported\n");
     }
@@ -255,6 +262,7 @@
     }
     [self setNeedsDisplay:YES];
     free(streamData);
+    [activeURLHandles removeObject:sender];
 }
 
 - (void)WCURLHandleResourceDidBeginLoading:(id)sender userData:(void *)userData
@@ -528,8 +536,12 @@
 - (void)stop
 {
     NPError npErr;
+    unsigned i;
     
     if (!stopped){
+        for(i=0; i<[activeURLHandles count]; i++){
+            [[activeURLHandles objectAtIndex:i] cancelLoadInBackground];
+        }
         [eventSender stop];
         [eventSender release];
         npErr = NPP_Destroy(instance, NULL);
@@ -554,6 +566,7 @@
         [fileManager removeFileAtPath:[filesToErase objectAtIndex:i] handler:nil]; 
     }
     [filesToErase release];
+    [activeURLHandles release];
     [mime release];
     [URL release];
     [plugin release];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list