diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-30 15:48:01 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-30 15:48:01 +0530 |
| commit | e690963fb6c0240171236fc2d669f95ee26b6798 (patch) | |
| tree | 367a74e7d23c44ff6d9a576dc08e34cf43e2d65c /src/WindowActionRouter.cpp | |
| parent | 997891b27d17377111f484c62ba41caf15475d72 (diff) | |
| download | null-browser-e690963fb6c0240171236fc2d669f95ee26b6798.tar.gz null-browser-e690963fb6c0240171236fc2d669f95ee26b6798.zip | |
Remove from router on window close
Diffstat (limited to '')
| -rw-r--r-- | src/WindowActionRouter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/WindowActionRouter.cpp b/src/WindowActionRouter.cpp index 51fb1af..c04b330 100644 --- a/src/WindowActionRouter.cpp +++ b/src/WindowActionRouter.cpp @@ -63,9 +63,13 @@ void WindowActionRouter::initialize() { } void WindowActionRouter::add_window(BrowserWindow *window) { - window_map.insert({last_id, window}); - window->set_id(last_id); + auto win_id = last_id; last_id++; + + window_map.insert({win_id, window}); + window->set_id(win_id); + connect(window, &BrowserWindow::closed, this, + [this, win_id]() { window_map.erase(win_id); }); } const WindowMap &WindowActionRouter::windows() { return window_map; } |
