[gucharmap/gnome-2-32] Fix crash on searching



commit b1177ebd5dff6591fa748eeebf6b215acd3dbdf0
Author: Martin Schlemmer <Martin Schlemmer nwu ac za>
Date:   Thu Nov 11 17:46:18 2010 +0100

    Fix crash on searching
    
    Bug #624929.

 gucharmap/gucharmap-chartable.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/gucharmap/gucharmap-chartable.c b/gucharmap/gucharmap-chartable.c
index 1e7c736..29944ec 100644
--- a/gucharmap/gucharmap-chartable.c
+++ b/gucharmap/gucharmap-chartable.c
@@ -1038,22 +1038,6 @@ draw_square (GucharmapChartable *chartable, gint row, gint col)
   draw_character (chartable, row, col);
 }
 
-static void
-draw_and_expose_cell (GucharmapChartable *chartable,
-                      guint cell)
-{
-  GucharmapChartablePrivate *priv = chartable->priv;
-
-  gint row = (cell - priv->page_first_cell) / priv->cols;
-  gint col = _gucharmap_chartable_cell_column (chartable, cell);
-
-  if (row >= 0 && row < priv->rows && col >= 0 && col < priv->cols)
-    {
-      draw_square (chartable, row, col);
-      expose_square (chartable, row, col);
-    }
-}
-
 /* draws the backing store pixmap */
 static void
 draw_chartable_from_scratch (GucharmapChartable *chartable)
@@ -1098,6 +1082,26 @@ draw_chartable_from_scratch (GucharmapChartable *chartable)
 }
 
 static void
+draw_and_expose_cell (GucharmapChartable *chartable,
+                      guint cell)
+{
+  GucharmapChartablePrivate *priv = chartable->priv;
+  gint row, col;
+
+  if (priv->pixmap == NULL)
+    draw_chartable_from_scratch (chartable);
+
+  row = (cell - priv->page_first_cell) / priv->cols;
+  col = _gucharmap_chartable_cell_column (chartable, cell);
+
+  if (row >= 0 && row < priv->rows && col >= 0 && col < priv->cols)
+    {
+      draw_square (chartable, row, col);
+      expose_square (chartable, row, col);
+    }
+}
+
+static void
 copy_rows (GucharmapChartable *chartable, gint row_offset)
 {
   GucharmapChartablePrivate *priv = chartable->priv;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]