summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 00:07:25 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 00:07:25 +0000
commit47c7218f1ec490ea270a015f53080405f1e7a760 (patch)
treecfc94ef3335b8b331c803ce3328dd841bd16a1f6
parentdce8e2103ed576554e21b90d86e5327f64a426de (diff)
downloadchromium_src-47c7218f1ec490ea270a015f53080405f1e7a760.zip
chromium_src-47c7218f1ec490ea270a015f53080405f1e7a760.tar.gz
chromium_src-47c7218f1ec490ea270a015f53080405f1e7a760.tar.bz2
make sure to destroy main window when test shell is shutting down so we don't get called back in our signal handlers and access freed memory.
BUG=17188 TEST=sh tools/valgrind/valgrind_webkit_tests.sh LayoutTests/editing/pasteboard works Review URL: http://codereview.chromium.org/155893 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21345 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--tools/valgrind/memcheck/suppressions.txt7
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc6
2 files changed, 5 insertions, 8 deletions
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index 7891efa..4752d68 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -935,13 +935,6 @@
fun:_ZN7WebCore10Pasteboard10writeImageEPNS_4NodeERKNS_4KURLERKNS_6StringE
}
{
- # Only in test shell
- bug_17188
- Memcheck:Addr4
- fun:_ZN9TestShell10ClosePopupEv
- fun:_ZN12_GLOBAL__N_119MainWindowLostFocusEP10_GtkWidgetP14_GdkEventFocusP9TestShell
-}
-{
bug_17385
Memcheck:Leak
fun:_Znw*
diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index 7d904d66..c5773b2 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -209,6 +209,8 @@ void TestShell::PlatformCleanUp() {
// The GTK widgets will be destroyed, which will free the associated
// objects. So we don't need the scoped_ptr to free the webViewHost.
m_webViewHost.release();
+ if (m_mainWnd)
+ gtk_widget_destroy(GTK_WIDGET(m_mainWnd));
}
namespace {
@@ -217,7 +219,6 @@ namespace {
// Callback for when the main window is destroyed.
gboolean MainWindowDestroyed(GtkWindow* window, TestShell* shell) {
-
TestShell::RemoveWindowFromList(window);
if (TestShell::windowList()->empty() || shell->is_modal()) {
@@ -317,6 +318,9 @@ bool TestShell::Initialize(const std::wstring& startingURL) {
gtk_window_set_title(m_mainWnd, "Test Shell");
g_signal_connect(G_OBJECT(m_mainWnd), "destroy",
G_CALLBACK(MainWindowDestroyed), this);
+ // Null out m_mainWnd when it is destroyed so we don't destroy it twice.
+ g_signal_connect(G_OBJECT(m_mainWnd), "destroy",
+ G_CALLBACK(gtk_widget_destroyed), &m_mainWnd);
g_signal_connect(G_OBJECT(m_mainWnd), "focus-out-event",
G_CALLBACK(MainWindowLostFocus), this);
g_object_set_data(G_OBJECT(m_mainWnd), "test-shell", this);