Commit 73cede1f authored by darin@apple.com's avatar darin@apple.com
Browse files

2008-05-21 Darin Adler <darin@apple.com>

        Reviewed by Anders and Kevin Decker.

        - fix <rdar://problem/5951130> REGRESSION: crash on quit after reopening windows from previous session

        * WebView/WebView.mm:
        (-[WebViewPrivate dealloc]): Fix assertions to not complain when fast teardown is used.
        (-[WebView _closePluginDatabases]): Factored out some common code from both versions of close.
        (-[WebView _closeWithFastTeardown]): Added an underscore to this method's name, since it's internal.
        Streamlined the code a bit. Added a line of code to set _private->closed (this is the bug fix).
        (-[WebView _close]): Changed for new method name and to use _closePluginDatabases.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8dfb5c65
2008-05-21 Darin Adler <darin@apple.com>
Reviewed by Anders and Kevin Decker.
- fix <rdar://problem/5951130> REGRESSION: crash on quit after reopening windows from previous session
* WebView/WebView.mm:
(-[WebViewPrivate dealloc]): Fix assertions to not complain when fast teardown is used.
(-[WebView _closePluginDatabases]): Factored out some common code from both versions of close.
(-[WebView _closeWithFastTeardown]): Added an underscore to this method's name, since it's internal.
Streamlined the code a bit. Added a line of code to set _private->closed (this is the bug fix).
(-[WebView _close]): Changed for new method name and to use _closePluginDatabases.
2008-05-19 Stephanie Lewis <slewis@apple.com>
Reviewed by Darin.
......
......@@ -491,8 +491,8 @@ static BOOL grammarCheckingEnabled;
- (void)dealloc
{
ASSERT(!page);
ASSERT(!preferences);
ASSERT(applicationIsTerminating || !page);
ASSERT(applicationIsTerminating || !preferences);
delete userAgent;
delete identifierMap;
......@@ -687,24 +687,12 @@ static bool debugWidget = true;
return NO;
}
- (void) closeWithFastTeardown
- (void)_closePluginDatabases
{
Frame *mainFrame = core([self mainFrame]);
BOOL hasUnloadEvent = NO;
if (mainFrame && mainFrame->page())
hasUnloadEvent = mainFrame->page()->pendingUnloadEventCount();
if (hasUnloadEvent) {
RefPtr<Frame> protect(mainFrame);
// dispatch unload Events
mainFrame->loader()->stopLoading(true);
}
pluginDatabaseClientCount--;
// Make sure to close both sets of plug-ins databases because plug-ins need an opportunity to clean up files, etc.
// Close both sets of plug-in databases because plug-ins need an opportunity to clean up files, etc.
// Unload the WebView local plug-in database.
if (_private->pluginDatabase) {
[_private->pluginDatabase destroyAllPluginInstanceViews];
......@@ -718,19 +706,33 @@ static bool debugWidget = true;
[WebPluginDatabase closeSharedDatabase];
}
- (void)_closeWithFastTeardown
{
// Dispatch unload events.
// FIXME: Shouldn't have to use a RefPtr here -- keeping the frame alive while stopping it
// should be WebCore's responsibility -- but we do as of the time this comment was written.
RefPtr<Frame> mainFrame = core([self mainFrame]);
if (mainFrame && mainFrame->page() && mainFrame->page()->pendingUnloadEventCount())
mainFrame->loader()->stopLoading(true);
_private->closed = YES;
[self _closePluginDatabases];
}
- (void)_close
{
if (!_private || _private->closed)
return;
WebPreferences *preferences = _private->preferences;
BOOL fullDocumentTeardown = [preferences fullDocumentTeardownEnabled];
BOOL fullDocumentTeardown = [preferences fullDocumentTeardownEnabled];
// To quit the apps fast we skip document teardown. Two exceptions:
// 1) plugins need to be destroyed and unloaded
// 2) unload events need to be called
if (applicationIsTerminating && !fullDocumentTeardown) {
[self closeWithFastTeardown];
[self _closeWithFastTeardown];
return;
}
......@@ -776,20 +778,7 @@ static bool debugWidget = true;
[preferences didRemoveFromWebView];
[preferences release];
pluginDatabaseClientCount--;
// Make sure to close both sets of plug-ins databases because plug-ins need an opportunity to clean up files, etc.
// Unload the WebView local plug-in database.
if (_private->pluginDatabase) {
[_private->pluginDatabase close];
[_private->pluginDatabase release];
_private->pluginDatabase = nil;
}
// Keep the global plug-in database active until the app terminates to avoid having to reload plug-in bundles.
if (!pluginDatabaseClientCount && applicationIsTerminating)
[WebPluginDatabase closeSharedDatabase];
[self _closePluginDatabases];
}
+ (NSString *)_MIMETypeForFile:(NSString *)path
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment