Fix double-delete of BrowserMainParts

The caller of BrowserClient::CreateBrowserMainParts handles destroying the
BrowserMainParts instance we return.
This commit is contained in:
Adam Roben 2013-03-27 08:54:19 -04:00
parent 90691e394f
commit 881a203b57
2 changed files with 5 additions and 4 deletions

View file

@ -24,8 +24,9 @@ BrowserMainParts* BrowserClient::OverrideCreateBrowserMainParts(const content::M
}
content::BrowserMainParts* BrowserClient::CreateBrowserMainParts(const content::MainFunctionParams& parameters) {
browser_main_parts_.reset(OverrideCreateBrowserMainParts(parameters));
return browser_main_parts_.get();
DCHECK(!browser_main_parts_);
browser_main_parts_ = OverrideCreateBrowserMainParts(parameters);
return browser_main_parts_;
}
net::URLRequestContextGetter* BrowserClient::CreateRequestContext(content::BrowserContext* browser_context, content::ProtocolHandlerMap* protocol_handlers) {

View file

@ -18,7 +18,7 @@ public:
~BrowserClient();
BrowserContext* browser_context();
BrowserMainParts* browser_main_parts() { return browser_main_parts_.get(); }
BrowserMainParts* browser_main_parts() { return browser_main_parts_; }
protected:
// Subclasses should override this to provide their own BrowserMainParts implementation. The
@ -29,7 +29,7 @@ private:
virtual content::BrowserMainParts* CreateBrowserMainParts(const content::MainFunctionParams&) OVERRIDE;
virtual net::URLRequestContextGetter* CreateRequestContext(content::BrowserContext*, content::ProtocolHandlerMap*) OVERRIDE;
scoped_ptr<BrowserMainParts> browser_main_parts_;
BrowserMainParts* browser_main_parts_;
DISALLOW_COPY_AND_ASSIGN(BrowserClient);
};