diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-14 01:56:05 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-14 01:56:05 +0000 |
commit | f1c9826afffc7f26e760d3a987b822ec401af0d9 (patch) | |
tree | a4b348ca510cda478d9e1d4982b5744e51bbf8b0 | |
parent | edf82d1c54334d45226bbb91d2cb51cd000f7b6f (diff) | |
download | chromium_src-f1c9826afffc7f26e760d3a987b822ec401af0d9.zip chromium_src-f1c9826afffc7f26e760d3a987b822ec401af0d9.tar.gz chromium_src-f1c9826afffc7f26e760d3a987b822ec401af0d9.tar.bz2 |
Reduce creation of ViewsDelegate
By consolidating override of OnBeforeWidgetInit that finds shell many
of the places that were setting a viewsdelegate no longer need to.
Also, made AshTestHelper install a ViewsDelegate so that tests don't have.
Because of removed an include of views_delegate from ash_test_helper I had to update some includes.
BUG=none
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/280863002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270290 0039d316-1c4b-4281-b951-d872f2087c98
21 files changed, 105 insertions, 100 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index a69869d..d23db52 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -804,6 +804,8 @@ 'test/ash_test_base.h', 'test/ash_test_helper.cc', 'test/ash_test_helper.h', + 'test/ash_test_views_delegate.cc', + 'test/ash_test_views_delegate.h', 'test/cursor_manager_test_api.cc', 'test/cursor_manager_test_api.h', 'test/display_manager_test_api.cc', diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 9ef0b9b..7e84ed4 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -26,7 +26,6 @@ #include "ui/events/gestures/gesture_types.h" #include "ui/gfx/animation/linear_animation.h" #include "ui/gfx/image/image_skia_rep.h" -#include "ui/views/test/test_views_delegate.h" #include "ui/views/view.h" #include "ui/views/views_delegate.h" #include "ui/views/widget/native_widget_aura.h" @@ -299,7 +298,6 @@ class DragDropControllerTest : public AshTestBase { drag_drop_controller_->set_should_block_during_drag_drop(false); aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), drag_drop_controller_.get()); - views_delegate_.reset(new views::TestViewsDelegate); } virtual void TearDown() OVERRIDE { @@ -344,7 +342,6 @@ class DragDropControllerTest : public AshTestBase { protected: scoped_ptr<TestDragDropController> drag_drop_controller_; - scoped_ptr<views::TestViewsDelegate> views_delegate_; private: DISALLOW_COPY_AND_ASSIGN(DragDropControllerTest); diff --git a/ash/first_run/first_run_helper_unittest.cc b/ash/first_run/first_run_helper_unittest.cc index a86c064..15e42bf 100644 --- a/ash/first_run/first_run_helper_unittest.cc +++ b/ash/first_run/first_run_helper_unittest.cc @@ -10,6 +10,7 @@ #include "ash/test/ash_test_base.h" #include "ui/aura/test/event_generator.h" #include "ui/events/event_handler.h" +#include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" namespace ash { diff --git a/ash/screensaver/screensaver_view_unittest.cc b/ash/screensaver/screensaver_view_unittest.cc index 19be19e..2809025 100644 --- a/ash/screensaver/screensaver_view_unittest.cc +++ b/ash/screensaver/screensaver_view_unittest.cc @@ -18,7 +18,6 @@ class ScreensaverViewTest : public ash::test::AshTestBase { public: ScreensaverViewTest() { url_ = GURL("http://www.google.com"); - views_delegate_.reset(new AshTestViewsDelegate()); webview_test_helper_.reset(new views::WebViewTestHelper()); } @@ -44,7 +43,6 @@ class ScreensaverViewTest : public ash::test::AshTestBase { GURL url_; private: - scoped_ptr<AshTestViewsDelegate> views_delegate_; scoped_ptr<views::WebViewTestHelper> webview_test_helper_; DISALLOW_COPY_AND_ASSIGN(ScreensaverViewTest); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 61fa218..cfd3142 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -19,7 +19,6 @@ #include "ash/wm/coordinate_conversion.h" #include "ash/wm/window_positioner.h" #include "base/command_line.h" -#include "content/public/test/web_contents_tester.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/client/window_tree_client.h" @@ -81,13 +80,6 @@ class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { } // namespace -content::WebContents* AshTestViewsDelegate::CreateWebContents( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance) { - return content::WebContentsTester::CreateTestWebContents(browser_context, - site_instance); -} - ///////////////////////////////////////////////////////////////////////////// AshTestBase::AshTestBase() diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h index 4ac828e..6ef1591 100644 --- a/ash/test/ash_test_base.h +++ b/ash/test/ash_test_base.h @@ -13,13 +13,16 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkColor.h" -#include "ui/views/test/test_views_delegate.h" #include "ui/wm/public/window_types.h" #if defined(OS_WIN) #include "ui/base/win/scoped_ole_initializer.h" #endif +namespace gfx { +class Rect; +} + namespace aura { class RootWindow; class Window; @@ -42,14 +45,6 @@ class TestSystemTrayDelegate; class TestMetroViewerProcessHost; #endif -class AshTestViewsDelegate : public views::TestViewsDelegate { - public: - // Overriden from TestViewsDelegate. - virtual content::WebContents* CreateWebContents( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance) OVERRIDE; -}; - class AshTestBase : public testing::Test { public: AshTestBase(); diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index 9cf3488..a59019b 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -7,6 +7,7 @@ #include "ash/accelerators/accelerator_controller.h" #include "ash/ash_switches.h" #include "ash/shell.h" +#include "ash/test/ash_test_views_delegate.h" #include "ash/test/display_manager_test_api.h" #include "ash/test/shell_test_api.h" #include "ash/test/test_screenshot_delegate.h" @@ -22,7 +23,6 @@ #include "ui/compositor/test/context_factories_for_test.h" #include "ui/message_center/message_center.h" #include "ui/wm/core/capture_controller.h" -#include "ui/wm/core/wm_state.h" #if defined(OS_CHROMEOS) #include "chromeos/audio/cras_audio_handler.h" @@ -56,7 +56,7 @@ AshTestHelper::~AshTestHelper() { } void AshTestHelper::SetUp(bool start_session) { - wm_state_.reset(new wm::WMState); + views_delegate_.reset(new AshTestViewsDelegate); // Disable animations during tests. zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( @@ -133,7 +133,7 @@ void AshTestHelper::TearDown() { CHECK(!wm::ScopedCaptureClient::IsActive()); - wm_state_.reset(); + views_delegate_.reset(); } void AshTestHelper::RunAllPendingInMessageLoop() { diff --git a/ash/test/ash_test_helper.h b/ash/test/ash_test_helper.h index 6fb266f..b42cc72 100644 --- a/ash/test/ash_test_helper.h +++ b/ash/test/ash_test_helper.h @@ -20,8 +20,8 @@ namespace ui { class ScopedAnimationDurationScaleMode; } // namespace ui -namespace wm { -class WMState; +namespace views { +class ViewsDelegate; } namespace ash { @@ -77,7 +77,7 @@ class AshTestHelper { // Owned by ash::AcceleratorController TestScreenshotDelegate* test_screenshot_delegate_; - scoped_ptr<wm::WMState> wm_state_; + scoped_ptr<views::ViewsDelegate> views_delegate_; // Check if DBus Thread Manager was initialized here. bool dbus_thread_manager_initialized_; diff --git a/ash/test/ash_test_views_delegate.cc b/ash/test/ash_test_views_delegate.cc new file mode 100644 index 0000000..c47bdba --- /dev/null +++ b/ash/test/ash_test_views_delegate.cc @@ -0,0 +1,38 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/test/ash_test_views_delegate.h" + +#include "ash/shell.h" +#include "content/public/test/web_contents_tester.h" + +namespace ash { +namespace test { + +AshTestViewsDelegate::AshTestViewsDelegate() { +} + +AshTestViewsDelegate::~AshTestViewsDelegate() { +} + +content::WebContents* AshTestViewsDelegate::CreateWebContents( + content::BrowserContext* browser_context, + content::SiteInstance* site_instance) { + return content::WebContentsTester::CreateTestWebContents(browser_context, + site_instance); +} + +void AshTestViewsDelegate::OnBeforeWidgetInit( + views::Widget::InitParams* params, + views::internal::NativeWidgetDelegate* delegate) { + TestViewsDelegate::OnBeforeWidgetInit(params, delegate); + + if (!params->parent && !params->context && ash::Shell::HasInstance()) { + // If the window has neither a parent nor a context add to the root. + params->parent = ash::Shell::GetInstance()->GetPrimaryRootWindow(); + } +} + +} // namespace test +} // namespace ash diff --git a/ash/test/ash_test_views_delegate.h b/ash/test/ash_test_views_delegate.h new file mode 100644 index 0000000..6fd8bd4 --- /dev/null +++ b/ash/test/ash_test_views_delegate.h @@ -0,0 +1,37 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_TEST_ASH_TEST_VIEWS_DELEGATE_H_ +#define ASH_TEST_ASH_TEST_VIEWS_DELEGATE_H_ + +#include "ui/views/test/test_views_delegate.h" + +namespace ash { +namespace test { + +// Ash specific ViewsDelegate. In addition to creating a TestWebContents this +// parents widget with no parent/context to the shell. This is created by +// default AshTestHelper. +class AshTestViewsDelegate : public views::TestViewsDelegate { + public: + AshTestViewsDelegate(); + virtual ~AshTestViewsDelegate(); + + // Overriden from TestViewsDelegate. + virtual content::WebContents* CreateWebContents( + content::BrowserContext* browser_context, + content::SiteInstance* site_instance) OVERRIDE; + virtual void OnBeforeWidgetInit( + views::Widget::InitParams* params, + views::internal::NativeWidgetDelegate* delegate) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(AshTestViewsDelegate); +}; + +} // namespace test +} // namespace ash + +#endif // ASH_TEST_ASH_TEST_VIEWS_DELEGATE_H_ + diff --git a/ash/touch/touch_observer_hud_unittest.cc b/ash/touch/touch_observer_hud_unittest.cc index e0e133f..d5c7e2a 100644 --- a/ash/touch/touch_observer_hud_unittest.cc +++ b/ash/touch/touch_observer_hud_unittest.cc @@ -17,6 +17,7 @@ #include "base/format_macros.h" #include "base/strings/stringprintf.h" #include "ui/aura/window.h" +#include "ui/views/widget/widget.h" namespace ash { diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 47f46df..fe1da3d 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -35,7 +35,9 @@ #include "ui/events/test/test_event_handler.h" #include "ui/gfx/screen.h" #include "ui/gfx/size.h" +#include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" +#include "ui/views/window/non_client_view.h" namespace ash { namespace test { diff --git a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc index 5f22a9b..2f8d987 100644 --- a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc +++ b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc @@ -13,7 +13,6 @@ #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_error_notifier_factory_ash.h" #include "chrome/browser/signin/signin_manager_factory.h" -#include "chrome/browser/ui/ash/test_views_delegate_with_parent.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" @@ -63,8 +62,6 @@ class ScreenTypeDelegateDesktop : public gfx::ScreenTypeDelegate { class SigninErrorNotifierTest : public AshTestBase { public: virtual void SetUp() OVERRIDE { - views::ViewsDelegate::views_delegate = &views_delegate_; - // Create a signed-in profile. TestingProfile::Builder builder; builder.AddTestingFactory(SigninManagerFactory::GetInstance(), @@ -111,7 +108,6 @@ class SigninErrorNotifierTest : public AshTestBase { scoped_ptr<TestingProfile> profile_; SigninErrorController* error_controller_; NotificationUIManager* notification_ui_manager_; - TestViewsDelegateWithParent views_delegate_; }; TEST_F(SigninErrorNotifierTest, NoErrorAuthStatusProviders) { diff --git a/chrome/browser/sync/sync_error_notifier_ash_unittest.cc b/chrome/browser/sync/sync_error_notifier_ash_unittest.cc index 4f5bb65..ebcdf29 100644 --- a/chrome/browser/sync/sync_error_notifier_ash_unittest.cc +++ b/chrome/browser/sync/sync_error_notifier_ash_unittest.cc @@ -11,7 +11,6 @@ #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/browser/sync/sync_error_controller.h" -#include "chrome/browser/ui/ash/test_views_delegate_with_parent.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/webui/signin/login_ui_service.h" #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" @@ -98,8 +97,6 @@ class SyncErrorNotifierTest : public AshTestBase { virtual ~SyncErrorNotifierTest() {} virtual void SetUp() OVERRIDE { - views::ViewsDelegate::views_delegate = &views_delegate_; - profile_manager_.reset( new TestingProfileManager(TestingBrowserProcess::GetGlobal())); ASSERT_TRUE(profile_manager_->SetUp()); @@ -175,7 +172,6 @@ class SyncErrorNotifierTest : public AshTestBase { TestingProfile* profile_; FakeLoginUI login_ui_; NotificationUIManager* notification_ui_manager_; - TestViewsDelegateWithParent views_delegate_; DISALLOW_COPY_AND_ASSIGN(SyncErrorNotifierTest); }; diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 887cf81..5ce00fc 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc @@ -27,7 +27,6 @@ #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" -#include "chrome/browser/ui/ash/test_views_delegate_with_parent.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_finder.h" @@ -922,10 +921,6 @@ class MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest created_profiles_.erase(it); } - virtual views::ViewsDelegate* CreateViewsDelegate() OVERRIDE { - return new TestViewsDelegateWithParent; - } - private: typedef std::map<Profile*, std::string> ProfileToNameMap; TestingProfileManager* profile_manager() { return profile_manager_.get(); } diff --git a/chrome/browser/ui/ash/test_views_delegate_with_parent.cc b/chrome/browser/ui/ash/test_views_delegate_with_parent.cc deleted file mode 100644 index 27feacb..0000000 --- a/chrome/browser/ui/ash/test_views_delegate_with_parent.cc +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/ash/test_views_delegate_with_parent.h" - -#include "ash/shell.h" - -TestViewsDelegateWithParent::TestViewsDelegateWithParent() { -} - -TestViewsDelegateWithParent::~TestViewsDelegateWithParent() { -} - -void TestViewsDelegateWithParent::OnBeforeWidgetInit( - views::Widget::InitParams* params, - views::internal::NativeWidgetDelegate* delegate) { - if (!params->parent && !params->context) { - // If the window has neither a parent nor a context we add the root window - // as parent. - params->parent = ash::Shell::GetInstance()->GetPrimaryRootWindow(); - } -} diff --git a/chrome/browser/ui/ash/test_views_delegate_with_parent.h b/chrome/browser/ui/ash/test_views_delegate_with_parent.h deleted file mode 100644 index f876c73..0000000 --- a/chrome/browser/ui/ash/test_views_delegate_with_parent.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_ASH_TEST_VIEWS_DELEGATE_WITH_PARENT_H_ -#define CHROME_BROWSER_UI_ASH_TEST_VIEWS_DELEGATE_WITH_PARENT_H_ - -#include "ui/views/test/test_views_delegate.h" - -// A views delegate which allows creating shell windows. -class TestViewsDelegateWithParent : public views::TestViewsDelegate { - public: - TestViewsDelegateWithParent(); - virtual ~TestViewsDelegateWithParent(); - - // views::TestViewsDelegate overrides. - virtual void OnBeforeWidgetInit( - views::Widget::InitParams* params, - views::internal::NativeWidgetDelegate* delegate) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(TestViewsDelegateWithParent); -}; - -#endif // CHROME_BROWSER_UI_ASH_TEST_VIEWS_DELEGATE_WITH_PARENT_H_ diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 1f1a4ba..da32b3a4 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1448,8 +1448,6 @@ 'browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc', 'browser/ui/ash/screenshot_taker_unittest.cc', 'browser/ui/ash/session_state_delegate_chromeos_unittest.cc', - 'browser/ui/ash/test_views_delegate_with_parent.cc', - 'browser/ui/ash/test_views_delegate_with_parent.h', 'browser/ui/ash/window_positioner_unittest.cc', 'browser/ui/autofill/account_chooser_model_unittest.cc', 'browser/ui/autofill/autofill_dialog_controller_unittest.cc', diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index e5de4b2..5d7cd98 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc @@ -25,6 +25,7 @@ #if defined(USE_ASH) #include "ash/test/ash_test_helper.h" +#include "ash/test/ash_test_views_delegate.h" #endif #if defined(TOOLKIT_VIEWS) @@ -59,7 +60,8 @@ void BrowserWithTestWindowTest::SetUp() { #if defined(OS_CHROMEOS) // TODO(jamescook): Windows Ash support. This will require refactoring // AshTestHelper and AuraTestHelper so they can be used at the same time, - // perhaps by AshTestHelper owning an AuraTestHelper. + // perhaps by AshTestHelper owning an AuraTestHelper. Also, need to cleanup + // CreateViewsDelegate() below when cleanup done. ash_test_helper_.reset(new ash::test::AshTestHelper( base::MessageLoopForUI::current())); ash_test_helper_->SetUp(true); @@ -73,9 +75,8 @@ void BrowserWithTestWindowTest::SetUp() { aura_test_helper_->SetUp(); new wm::DefaultActivationClient(aura_test_helper_->root_window()); #endif // USE_AURA -#if defined(TOOLKIT_VIEWS) +#if !defined(OS_CHROMEOS) && defined(TOOLKIT_VIEWS) views_delegate_.reset(CreateViewsDelegate()); - views::ViewsDelegate::views_delegate = views_delegate_.get(); #endif // Subclasses can provide their own Profile. @@ -113,7 +114,6 @@ void BrowserWithTestWindowTest::TearDown() { base::MessageLoop::current()->Run(); #if defined(TOOLKIT_VIEWS) - views::ViewsDelegate::views_delegate = NULL; views_delegate_.reset(NULL); #endif } @@ -241,8 +241,12 @@ Browser* BrowserWithTestWindowTest::CreateBrowser( return new Browser(params); } -#if defined(TOOLKIT_VIEWS) +#if !defined(OS_CHROMEOS) && defined(TOOLKIT_VIEWS) views::ViewsDelegate* BrowserWithTestWindowTest::CreateViewsDelegate() { +#if defined(USE_ASH) + return new ash::test::AshTestViewsDelegate; +#else return new views::TestViewsDelegate; +#endif } #endif diff --git a/chrome/test/base/browser_with_test_window_test.h b/chrome/test/base/browser_with_test_window_test.h index 4c832f4..9fa87d7 100644 --- a/chrome/test/base/browser_with_test_window_test.h +++ b/chrome/test/base/browser_with_test_window_test.h @@ -157,13 +157,13 @@ class BrowserWithTestWindowTest : public testing::Test { chrome::HostDesktopType host_desktop_type, BrowserWindow* browser_window); -#if defined(TOOLKIT_VIEWS) + private: +#if !defined(OS_CHROMEOS) && defined(TOOLKIT_VIEWS) // Creates the ViewsDelegate to use, may be overriden to create a different // ViewsDelegate. - virtual views::ViewsDelegate* CreateViewsDelegate(); + views::ViewsDelegate* CreateViewsDelegate(); #endif - private: // We need to create a MessageLoop, otherwise a bunch of things fails. content::TestBrowserThreadBundle thread_bundle_; base::ShadowingAtExitManager at_exit_manager_; diff --git a/ui/views/test/test_views_delegate.cc b/ui/views/test/test_views_delegate.cc index d68eb3f..b507f51 100644 --- a/ui/views/test/test_views_delegate.cc +++ b/ui/views/test/test_views_delegate.cc @@ -17,7 +17,8 @@ TestViewsDelegate::TestViewsDelegate() } TestViewsDelegate::~TestViewsDelegate() { - ViewsDelegate::views_delegate = NULL; + if (ViewsDelegate::views_delegate == this) + ViewsDelegate::views_delegate = NULL; } void TestViewsDelegate::SetUseTransparentWindows(bool transparent) { |