Commit bdaf950
committed
Fix memory leak due to Images of Graph
- Graph used a list self.Images to which new images where appended on
DrawImage. Neither in DeleteFigure nor in Erase were any elements
removed from that list. Thus any added image was kept in memory as
long as the corresponding Graph was; even if it wasn't used
anymore.
- Even though self.Images is not referred to in any other way,
removing the list completely does not work; the result
is that no images are drawn on the Graph.
- The implemented solution uses a dictionary (id -> image) to keep
only used images in self.Images.1 parent 7bfa71a commit bdaf950
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2029 | 2029 | | |
2030 | 2030 | | |
2031 | 2031 | | |
2032 | | - | |
| 2032 | + | |
2033 | 2033 | | |
2034 | 2034 | | |
2035 | 2035 | | |
| |||
2184 | 2184 | | |
2185 | 2185 | | |
2186 | 2186 | | |
2187 | | - | |
2188 | 2187 | | |
2189 | 2188 | | |
| 2189 | + | |
2190 | 2190 | | |
2191 | 2191 | | |
2192 | 2192 | | |
| |||
2198 | 2198 | | |
2199 | 2199 | | |
2200 | 2200 | | |
| 2201 | + | |
2201 | 2202 | | |
2202 | 2203 | | |
2203 | 2204 | | |
| |||
2206 | 2207 | | |
2207 | 2208 | | |
2208 | 2209 | | |
| 2210 | + | |
2209 | 2211 | | |
2210 | 2212 | | |
2211 | 2213 | | |
| |||
0 commit comments