summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Hakulinen <ville.hakulinen@gmail.com>2020-07-04 23:19:09 +0300
committerVille Hakulinen <ville.hakulinen@gmail.com>2020-07-12 01:57:30 +0300
commitaf9e9990c114bbe1ccbad8cf7db07af6135d6a0a (patch)
treeccf92756ce659408c9ad5529cc20582144dc2d0d
parent83073de44c953a7152dc4bf0765ec40c0ecb388c (diff)
Destroy window when destroying its grid
-rw-r--r--src/ui/state.rs3
-rw-r--r--src/ui/window.rs1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/ui/state.rs b/src/ui/state.rs
index bbf2c56..a6dd89d 100644
--- a/src/ui/state.rs
+++ b/src/ui/state.rs
@@ -204,6 +204,9 @@ impl UIState {
fn grid_destroy(&mut self, grid: &i64) {
// TODO(ville): Make sure all grid resources are freed.
self.grids.remove(grid).unwrap(); // Drop grid.
+ if self.windows.contains_key(grid) {
+ self.windows.remove(grid).unwrap(); // Drop window that the grid belongs to.
+ }
// Make the current grid to point to the default grid. We relay on the fact
// that current_grid is always pointing to a existing grid.
diff --git a/src/ui/window.rs b/src/ui/window.rs
index 0615df9..496bd7b 100644
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -161,6 +161,7 @@ impl Drop for Window {
// container.
self.frame.remove(&child);
}
+
self.frame.destroy();
if let Some(ref win) = self.external_win {