diff --git a/libcef/browser/chrome/views/chrome_browser_view.cc b/libcef/browser/chrome/views/chrome_browser_view.cc index b6a3b5889..96a9b44eb 100644 --- a/libcef/browser/chrome/views/chrome_browser_view.cc +++ b/libcef/browser/chrome/views/chrome_browser_view.cc @@ -11,6 +11,13 @@ ChromeBrowserView::ChromeBrowserView(CefBrowserViewImpl* cef_browser_view) : ParentClass(cef_browser_view->delegate()), cef_browser_view_(cef_browser_view) {} +ChromeBrowserView::~ChromeBrowserView() { + if (cef_toolbar_) { + WillDestroyToolbar(); + cef_toolbar_ = nullptr; + } +} + void ChromeBrowserView::InitBrowser(std::unique_ptr browser) { DCHECK(!web_view_); diff --git a/libcef/browser/chrome/views/chrome_browser_view.h b/libcef/browser/chrome/views/chrome_browser_view.h index 36899d2ba..404d61d80 100644 --- a/libcef/browser/chrome/views/chrome_browser_view.h +++ b/libcef/browser/chrome/views/chrome_browser_view.h @@ -30,6 +30,7 @@ class ChromeBrowserView // |cef_browser_view| is non-nullptr and will outlive this object. explicit ChromeBrowserView(CefBrowserViewImpl* cef_browser_view); + ~ChromeBrowserView() override; ChromeBrowserView(const ChromeBrowserView&) = delete; ChromeBrowserView& operator=(const ChromeBrowserView&) = delete;