Commits

Virgil Dupras committed 6b0cc50

Only draw charts if it has a view to avoid crashes in cases where draw() is called during the view's destruction.

  • Participants
  • Parent commits 7451cb3

Comments (0)

Files changed (4)

 62a55da0cd9750c2f67e6e95a1516649ae8a8ec5 ambuttonbar
 cfb29fa3d85b7ed88ffca9a0674d1ea6f218918e cocoalib
-feece3dd7aa501a399d2178b84508541522e93ef hscommon
+0d67cda31b7bb500e6029c58a85a42959bb52ec8 hscommon
 bbc3cc9d5986f4a9b96e400298a2dbd0ff614173 psmtabbarcontrol
 b2e1dea7a9f763563fdf523c84d7eb4fd4b50549 qtlib

core/gui/chart.py

         raise NotImplementedError()
     
     def draw(self):
-        pass
+        if self.has_view():
+            self.draw_chart()
     
     #--- Public
     def set_view_size(self, width, height):

core/gui/graph.py

     def draw_graph_after_axis(self, context):
         pass
     
-    def draw(self):
+    def draw_chart(self):
         if not hasattr(self, 'xmax'): # we haven't computed yet
             return
         view_rect = Rect(0, 0, *self.view_size)

core/gui/pie_chart.py

             legend.compute_text_rect()
             self.view.draw_text(legend.text, legend.text_rect, FontID.Legend)
     
-    def draw(self):
+    def draw_chart(self):
         view_rect = Rect(0, 0, *self.view_size)
         title = self.title
         _, title_height = self.view.text_size(title, 1)