summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 19:12:41 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 19:12:41 +0000
commitc786d8d4b83c9112b564dc03fdc3aedd38ec3c3e (patch)
tree98ebc6a8aef05954289ba4604b11876bc350286b /views
parentfb0b70ed567c03c17a22ee1d6c5fff9473f3505b (diff)
downloadchromium_src-c786d8d4b83c9112b564dc03fdc3aedd38ec3c3e.zip
chromium_src-c786d8d4b83c9112b564dc03fdc3aedd38ec3c3e.tar.gz
chromium_src-c786d8d4b83c9112b564dc03fdc3aedd38ec3c3e.tar.bz2
Fixes bug in WidgetGtk. WidgetGtk::GetBounds can end up crashing. I
believe returning a location of 0x0 is effectively what Windows does too in this situation. BUG=none TEST=none Review URL: http://codereview.chromium.org/525105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35805 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/widget_gtk.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index 8f0696e..303fe36 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -66,7 +66,12 @@ static void GetWidgetPositionOnScreen(GtkWidget* widget, int* x, int *y) {
while (root && !GTK_IS_WINDOW(root)) {
root = gtk_widget_get_parent(root);
}
- DCHECK(root);
+ if (!root) {
+ // If root is null we're not parented. Return 0x0 and assume the caller will
+ // query again when we're parented.
+ *x = *y = 0;
+ return;
+ }
// Translate the coordinate from widget to root window.
gtk_widget_translate_coordinates(widget, root, 0, 0, x, y);
// Then adjust the position with the position of the root window.