summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-01 01:35:45 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-01 01:35:45 +0000
commit46ad7357844bdc3ed4a7fd40d73ad37b56d8c07d (patch)
tree7f59d4f23b6aab7501873aad177d251da981fcc3 /chrome
parent60c240ac311e2029d985f445e5f4e25374b61525 (diff)
downloadchromium_src-46ad7357844bdc3ed4a7fd40d73ad37b56d8c07d.zip
chromium_src-46ad7357844bdc3ed4a7fd40d73ad37b56d8c07d.tar.gz
chromium_src-46ad7357844bdc3ed4a7fd40d73ad37b56d8c07d.tar.bz2
Linux: Fix Valgrind error in VisitedLinkEventsTest.Coalescense.
I introduced the error in r22193; it shows up when there's no X server to connect to. I get a "GLib-GObject-CRITICAL **: g_object_get: assertion `G_IS_OBJECT (object)' failed" message with this change, but I'm not sure if it's from my code or if it was already there, and the tests still pass. TEST=ran VisitedLinkEventsTest.Coalescense under Valgrind with DISPLAY=:6 Review URL: http://codereview.chromium.org/159753 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22240 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc6
-rw-r--r--chrome/common/x11_util.cc4
-rw-r--r--chrome/common/x11_util.h2
3 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index e4f7155..ccfc556 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -1194,8 +1194,12 @@ GtkWindow* BrowserWindowGtk::GetBrowserWindowForXID(XID xid) {
// static
void BrowserWindowGtk::RegisterUserPrefs(PrefService* prefs) {
bool custom_frame_default = false;
- if (!prefs->HasPrefPath(prefs::kUseCustomChromeFrame))
+ // Avoid checking the window manager if we're not connected to an X server (as
+ // is the case in Valgrind tests).
+ if (x11_util::XDisplayExists() &&
+ !prefs->HasPrefPath(prefs::kUseCustomChromeFrame)) {
custom_frame_default = GetCustomFramePrefDefault();
+ }
prefs->RegisterBooleanPref(
prefs::kUseCustomChromeFrame, custom_frame_default);
}
diff --git a/chrome/common/x11_util.cc b/chrome/common/x11_util.cc
index 3af0115..1305fe1 100644
--- a/chrome/common/x11_util.cc
+++ b/chrome/common/x11_util.cc
@@ -26,6 +26,10 @@
namespace x11_util {
+bool XDisplayExists() {
+ return (gdk_display_get_default() != NULL);
+}
+
Display* GetXDisplay() {
static Display* display = NULL;
diff --git a/chrome/common/x11_util.h b/chrome/common/x11_util.h
index d9bcbb5..09b1c2b 100644
--- a/chrome/common/x11_util.h
+++ b/chrome/common/x11_util.h
@@ -34,6 +34,8 @@ namespace x11_util {
// These functions cache their results.
+// Check if there's an open connection to an X server.
+bool XDisplayExists();
// Return an X11 connection for the current, primary display.
Display* GetXDisplay();
// Return true iff the connection supports X shared memory