Changeset 19167 in webkit


Ignore:
Timestamp:
Jan 26, 2007, 4:52:16 PM (18 years ago)
Author:
kdecker
Message:

Reviewed by andersca.

Fixed: <rdar://problem/4946922> WebBaseNetscapePluginView leaks memory
http://bugs.webkit.org/show_bug.cgi?id=11523

  • Plugins/WebBaseNetscapePluginStream.m:

(-[WebBaseNetscapePluginStream setPlugin:]): Calls -[WebBaseNetscapePluginView disconnectStream:]

  • Plugins/WebBaseNetscapePluginView.h: Added disconnectStream: to header.
  • Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView stop]): Make a copy of the streams collection prior to calling stop all streams. This is necessary because calling stop has the side effect of removing the stream from this same collection. (-[WebBaseNetscapePluginView disconnectStream:]): Added. Removes the stream from the streams collection.
Location:
trunk/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r19135 r19167  
     12007-01-26  Kevin Decker <kdecker@apple.com>
     2
     3        Reviewed by andersca.
     4
     5        Fixed: <rdar://problem/4946922> WebBaseNetscapePluginView leaks memory
     6        http://bugs.webkit.org/show_bug.cgi?id=11523
     7
     8        * Plugins/WebBaseNetscapePluginStream.m:
     9       (-[WebBaseNetscapePluginStream setPlugin:]): Calls -[WebBaseNetscapePluginView disconnectStream:]
     10        * Plugins/WebBaseNetscapePluginView.h: Added disconnectStream: to header.
     11        * Plugins/WebBaseNetscapePluginView.mm:
     12        (-[WebBaseNetscapePluginView stop]): Make a copy of the streams collection prior to calling stop all streams.
     13        This is necessary because calling stop has the side effect of removing the stream from this same collection.
     14        (-[WebBaseNetscapePluginView disconnectStream:]): Added. Removes the stream from the streams collection.
     15
    1162007-01-25  Kevin Decker <kdecker@apple.com>
    217
  • trunk/WebKit/Plugins/WebBaseNetscapePluginStream.m

    r19135 r19167  
    175175        NPP_URLNotify = [pluginPackage NPP_URLNotify];
    176176    } else {
     177        WebBaseNetscapePluginView *view = pluginView;
     178
    177179        plugin = NULL;
    178         [pluginView release];
    179         pluginView = nil;
    180180        NPP_NewStream = NULL;
    181181        NPP_WriteReady = NULL;
     
    184184        NPP_DestroyStream = NULL;
    185185        NPP_URLNotify = NULL;
     186        pluginView = nil;
     187
     188        [view disconnectStream:self];
     189        [view release];
    186190    }
    187191}
  • trunk/WebKit/Plugins/WebBaseNetscapePluginView.h

    r19135 r19167  
    152152- (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow;
    153153- (void)viewDidMoveToHostWindow;
     154- (void)disconnectStream:(WebBaseNetscapePluginStream*)stream;
    154155
    155156// Returns the NPObject that represents the plugin interface.
  • trunk/WebKit/Plugins/WebBaseNetscapePluginView.mm

    r19135 r19167  
    12911291   
    12921292    isStarted = NO;
    1293    
    1294     // Stop any active streams
    1295     [streams makeObjectsPerformSelector:@selector(stop)];
    1296    
     1293    // To stop active streams it's necessary to invoke makeObjectsPerformSelector on a copy
     1294    // of streams. This is because calling -[WebNetscapePluginStream stop] also has the side effect
     1295    // of removing a stream from this collection.
     1296    NSArray *streamsCopy = [streams copy];
     1297    [streamsCopy makeObjectsPerformSelector:@selector(stop)];
     1298    [streamsCopy release];
     1299   
    12971300    // Stop the null events
    12981301    [self stopNullEvents];
     
    14951498    free(cAttributes);
    14961499    free(cValues);
     1500}
     1501
     1502- (void)disconnectStream:(WebBaseNetscapePluginStream*)stream
     1503{
     1504    [streams removeObjectIdenticalTo:stream];   
    14971505}
    14981506
Note: See TracChangeset for help on using the changeset viewer.