glom r1782 - in branches/glom-1-8: . glom/utility_widgets/canvas



Author: murrayc
Date: Mon Dec  8 15:03:38 2008
New Revision: 1782
URL: http://svn.gnome.org/viewvc/glom?rev=1782&view=rev

Log:
2008-12-08  Murray Cumming  <murrayc murrayc com>

* glom/utility_widgets/canvas/canvas_group_grid.cc: create_lines():
Do not create the grid lines with 0 steps, to avoid a hang.
Ubuntu bug https://bugs.launchpad.net/ubuntu/+source/glom/+bug/303453
(elmergato)

Modified:
   branches/glom-1-8/ChangeLog
   branches/glom-1-8/glom/utility_widgets/canvas/canvas_group_grid.cc

Modified: branches/glom-1-8/glom/utility_widgets/canvas/canvas_group_grid.cc
==============================================================================
--- branches/glom-1-8/glom/utility_widgets/canvas/canvas_group_grid.cc	(original)
+++ branches/glom-1-8/glom/utility_widgets/canvas/canvas_group_grid.cc	Mon Dec  8 15:03:38 2008
@@ -223,25 +223,28 @@
   const double width = right - left;
   const double height = bottom - top;
 
-  const double count_vertical_grid_lines = width / m_grid_gap;
-  const double count_horizontal_grid_lines = height / m_grid_gap;
-  
-  //Vertical grid lines:
-  for(double i = 0; i < count_vertical_grid_lines; ++i)
+  if(m_grid_gap > 0) //0 steps cause a crash in older versions of goocanvas.
   {
-    const double x = i * m_grid_gap;
+    const double count_vertical_grid_lines = width / m_grid_gap;
+    const double count_horizontal_grid_lines = height / m_grid_gap;
+  
+    //Vertical grid lines:
+    for(double i = 0; i < count_vertical_grid_lines; ++i)
+    {
+      const double x = i * m_grid_gap;
    
-    Glib::RefPtr<Goocanvas::Polyline> line = create_grid_or_rule_line(x, top, x, bottom);
-    m_grid_lines_group->add_child(line);
-  }
-
-  //Horizontal grid lines:
-  for(double i = 0; i < count_horizontal_grid_lines; ++i)
-  {
-    const double y = i * m_grid_gap;
-
-    Glib::RefPtr<Goocanvas::Polyline> line = create_grid_or_rule_line(left, y, right, y);
-    m_grid_lines_group->add_child(line);
+      Glib::RefPtr<Goocanvas::Polyline> line = create_grid_or_rule_line(x, top, x, bottom);
+      m_grid_lines_group->add_child(line);
+    }
+
+    //Horizontal grid lines:
+    for(double i = 0; i < count_horizontal_grid_lines; ++i)
+    {
+      const double y = i * m_grid_gap;
+
+      Glib::RefPtr<Goocanvas::Polyline> line = create_grid_or_rule_line(left, y, right, y);
+      m_grid_lines_group->add_child(line);
+    }
   }
 
   //Vertical rules:



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