* Use a different deletion strategy for the BWebView. Since the BWebPage will

delete itself in the application thread, we cannot delete the BWebView before
   this happens in the window thread. Now BWebPage is repsonsible for deleting
   the view.
 * Also make sure that there are not still loaders running on the frame. Since
   the timer messages arrive in a different handler than the BWebPage handler,
   the timer functions being called could operate on stale pointers. I am not
   sure why WebCore doesn't make sure of this itself. Perhaps we are not supposed
   to delete something directly, but via reference counting. Though I am not sure
   what it would be, since WebCore::Page is not reference countable. Maybe the
   frame... need to investigate. After all, there could be other timers in the
   queue besides loading related ones.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@295 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
stippi 2010-03-06 12:41:48 +00:00 committed by Alexandre Deckner
parent 0fe64862b7
commit c108caf865
2 changed files with 15 additions and 2 deletions

View File

@ -527,7 +527,7 @@ BrowserWindow::MessageReceived(BMessage* message)
int32 index;
if (message->FindInt32("tab index", &index) != B_OK)
index = fTabManager->SelectedTabIndex();
delete fTabManager->RemoveTab(index);
_ShutdownTab(index);
_UpdateTabGroupVisibility();
} else
PostMessage(B_QUIT_REQUESTED);
@ -581,7 +581,7 @@ BrowserWindow::QuitRequested()
// Iterate over all tabs to delete all BWebViews.
// Do this here, so WebKit tear down happens earlier.
while (fTabManager->CountTabs() > 0)
delete fTabManager->RemoveTab(0L);
_ShutdownTab(0);
SetCurrentWebView(0);
BMessage message(WINDOW_CLOSED);
@ -900,3 +900,15 @@ BrowserWindow::_UpdateTabGroupVisibility()
Unlock();
}
}
void
BrowserWindow::_ShutdownTab(int32 index)
{
BView* view = fTabManager->RemoveTab(index);
BWebView* webView = dynamic_cast<BWebView*>(view);
if (webView)
webView->Shutdown();
else
delete view;
}

View File

@ -118,6 +118,7 @@ private:
private:
void _UpdateTitle(const BString &title);
void _UpdateTabGroupVisibility();
void _ShutdownTab(int32 index);
private:
BMessenger fDownloadListener;