Commit 476f2c14 authored by Morten Welinder's avatar Morten Welinder

SheetControlGUI: Fix potential crasher.

We're not derived from GtkWidget, so casting the class to that and
setting vtable entries will not end well.
parent 22ade9b7
2015-12-26 Morten Welinder <terra@gnome.org>
* src/sheet-control-gui.c (sheet_control_gui_new): Hook up screen
change here (on the grid).
(scg_class_init): Not here. We're not derived from GtkWidget.
* src/sheet-style.c (foreach_tile_r): Rename from foreach_tile.
(foreach_tile): New top-level function taking few parameters. All
callers changed.
......
Gnumeric 1.12.26
Morten:
* Fix potential crasher on showing initial window.
--------------------------------------------------------------------------
Gnumeric 1.12.25
......
......@@ -1565,6 +1565,18 @@ sheet_object_key_pressed (G_GNUC_UNUSED GtkWidget *w, GdkEventKey *event, SheetC
return TRUE;
}
static void
cb_screen_changed (GtkWidget *widget, G_GNUC_UNUSED GdkScreen *prev,
SheetControlGUI *scg)
{
GdkScreen *screen = gtk_widget_get_screen (widget);
if (screen) {
scg->screen_width = gdk_screen_get_width (screen);
scg->screen_height = gdk_screen_get_height (screen);
}
}
SheetControlGUI *
sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
{
......@@ -1765,6 +1777,11 @@ sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
NULL);
g_object_ref (scg->label);
g_signal_connect (G_OBJECT (scg->grid),
"screen-changed",
G_CALLBACK (cb_screen_changed),
scg);
return scg;
}
......@@ -3885,23 +3902,10 @@ scg_show_im_tooltip (SheetControl *sc, GnmInputMsg *im, GnmCellPos *pos)
}
static void
scg_screen_changed (GtkWidget *widget, G_GNUC_UNUSED GdkScreen *prev)
{
SheetControlGUI *scg = (SheetControlGUI *)widget;
GdkScreen *screen = gtk_widget_get_screen (widget);
if (screen) {
scg->screen_width = gdk_screen_get_width (screen);
scg->screen_height = gdk_screen_get_height (screen);
}
}
static void
scg_class_init (GObjectClass *object_class)
{
SheetControlClass *sc_class = SHEET_CONTROL_CLASS (object_class);
GtkWidgetClass *wclass = (GtkWidgetClass *)object_class;
g_return_if_fail (sc_class != NULL);
......@@ -3909,8 +3913,6 @@ scg_class_init (GObjectClass *object_class)
object_class->finalize = scg_finalize;
wclass->screen_changed = scg_screen_changed;
sc_class->resize = scg_resize_virt;
sc_class->redraw_all = scg_redraw_all;
sc_class->redraw_range = scg_redraw_range;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment