Prevent Chrome from crashing if a tab is closed while the media settings...

Prevent Chrome from crashing if a tab is closed while the media settings bubble is opea and a settings was changed.n


BUG=173204
TEST=(1) Visit apprtc.appspot.com and allow the website to capture you mic and cam.
  (2) Click on the camera icon on the right side of the omnibox to open the media settings bubble.
  (3) Change the media settings to block, but don't close the bubble
  (4) Close the tab with the open bubble
  (5) Verify that Chrome does not crash.

Review URL: https://chromiumcodereview.appspot.com/14326003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194918 0039d316-1c4b-4281-b951-d872f2087c98
parent 53d4de46
......@@ -446,7 +446,9 @@ ContentSettingCookiesBubbleModel::ContentSettingCookiesBubbleModel(
}
ContentSettingCookiesBubbleModel::~ContentSettingCookiesBubbleModel() {
if (settings_changed()) {
// On some plattforms e.g. MacOS X it is possible to close a tab while the
// cookies settubgs bubble is open. This resets the web contents to NULL.
if (settings_changed() && web_contents()) {
CollectedCookiesInfoBarDelegate::Create(
InfoBarService::FromWebContents(web_contents()));
}
......@@ -610,6 +612,10 @@ ContentSettingMediaStreamBubbleModel::ContentSettingMediaStreamBubbleModel(
}
ContentSettingMediaStreamBubbleModel::~ContentSettingMediaStreamBubbleModel() {
// On some plattforms e.g. MacOS X it is possible to close a tab while the
// media stream bubble is open. This resets the web contents to NULL.
if (!web_contents())
return;
bool media_setting_changed = false;
for (MediaMenuMap::const_iterator it = bubble_content().media_menus.begin();
it != bubble_content().media_menus.end(); ++it) {
......
Markdown is supported
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