Skip to content
Snippets Groups Projects
Commit 46ad7357 authored by derat@chromium.org's avatar derat@chromium.org
Browse files

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
parent 60c240ac
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -26,6 +26,10 @@
namespace x11_util {
bool XDisplayExists() {
return (gdk_display_get_default() != NULL);
}
Display* GetXDisplay() {
static Display* display = NULL;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment