OSDN Git Service

Added some more checks to prevents crashes in the GUI.
authorChris Schlaeger <cs@kde.org>
Sun, 18 Jan 2009 19:19:22 +0000 (20:19 +0100)
committerChris Schlaeger <cs@kde.org>
Sun, 18 Jan 2009 19:19:22 +0000 (20:19 +0100)
When pressing certain buttons and keys at a high rate, the GUI can
crash. These fixes make this more unlikely, but are not a proper fix.
Since this won't occur in normal operation, I don't spend time on
trying to fix this.

TaskJugglerUI/TjGanttChart.cpp
TaskJugglerUI/TjReport.cpp
docs/en/ChangeLog.xml

index 933c727..ea1f9d1 100644 (file)
@@ -1758,7 +1758,8 @@ TjGanttChart::time2x(time_t t) const
 time_t
 TjGanttChart::x2time(int x) const
 {
-    assert(zoomSteps.size() > 0);
+    if (zoomSteps.size() <= 0)
+        return -1;
 
     return (time_t) (startTime + ((float) x * 60 * 60 * 24 * 365) /
                      zoomSteps[currentZoomStep]->getPixelsPerYear());
index 8daaf89..d2738e4 100644 (file)
@@ -274,6 +274,7 @@ TjReport::regenerateChart()
     if (loadingProject) return;
 
     setCursor(KCursor::waitCursor());
+    setLoadingProject(true);
 
     prepareChart();
 
@@ -284,6 +285,7 @@ TjReport::regenerateChart()
     ganttChart->getHeaderCanvas()->update();
     ganttChart->getChartCanvas()->update();
 
+    setLoadingProject(false);
     setCursor(KCursor::arrowCursor());
 }
 
@@ -1432,11 +1434,13 @@ TjReport::getChartItemBelowCursor(QPoint& pos)
 void
 TjReport::zoomTo(const QString& label)
 {
-    if (!isVisible())
+    if (loadingProject || !isVisible())
         return;
 
     time_t x = ganttChart->x2time(ganttChartView->contentsX());
     int y = ganttChartView->contentsY();
+    if (x <= 0 && y <= 0)
+        return;
 
     if (!ganttChart->zoomTo(label))
         return;
@@ -1454,7 +1458,7 @@ TjReport::zoomTo(const QString& label)
 void
 TjReport::zoomIn()
 {
-    if (!isVisible())
+    if (loadingProject || !isVisible())
         return;
 
     time_t x = ganttChart->x2time(ganttChartView->contentsX());
@@ -1477,7 +1481,7 @@ TjReport::zoomIn()
 void
 TjReport::zoomOut()
 {
-    if (!isVisible())
+    if (loadingProject || !isVisible())
         return;
 
     time_t x = ganttChart->x2time(ganttChartView->contentsX());
index d5e7390..7c143e5 100644 (file)
@@ -1315,6 +1315,12 @@ characters are used.</para></listitem>
                and use separators between all
                columns.</para></listitem>
 
+<listitem><para>Fixed missing start time for certain tasks in ICal reports.</para></listitem>
+
+<listitem><para>Fixed wrong total values in CSV account reports when tree mode (default) was used.</para></listitem>
+
+<listitem><para>Fixed crash when pressing F9 at a high rate in the GUI.</para></listitem>
+
 </itemizedlist></para>
 
 </sect2>