Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20476)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2008-06-20  Chris Wilson  <chris@chris-wilson.co.uk>
+
+	* gtk/gtkcalendar.c (gtk_calendar_query_tooltip):
+	Check that the cursor is over a valid date before retrieving
+	its details.  Bug #539248.
+
 2008-06-20  Cody Russell  <cody@jhu.edu>
 
 	* gdk/directfb/gdkwindow-directfb.c:
Index: gtk/gtkcalendar.c
===================================================================
--- gtk/gtkcalendar.c	(revision 20476)
+++ gtk/gtkcalendar.c	(working copy)
@@ -1711,8 +1711,9 @@ gtk_calendar_query_tooltip (GtkWidget  *
       col = calendar_column_from_x (calendar, x - x0);
       row = calendar_row_from_y (calendar, y - y0);
 
-      if (0 != (priv->detail_overflow[row] & (1 << col)) ||
-          0 == (calendar->display_flags & GTK_CALENDAR_SHOW_DETAILS))
+      if (col != -1 && row != -1 &&
+	  (0 != (priv->detail_overflow[row] & (1 << col)) ||
+           0 == (calendar->display_flags & GTK_CALENDAR_SHOW_DETAILS)))
         {
           detail = gtk_calendar_get_detail (calendar, row, col);
           calendar_day_rectangle (calendar, row, col, &day_rect);
