mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed popups not getting deleted on close
This commit is contained in:
parent
c82254aa9e
commit
3484abd4af
1 changed files with 13 additions and 1 deletions
|
@ -95,10 +95,22 @@ widgets::Window &WindowManager::getSelectedWindow()
|
|||
widgets::Window &WindowManager::createWindow(widgets::Window::WindowType type)
|
||||
{
|
||||
auto *window = new widgets::Window(this->themeManager, type);
|
||||
|
||||
this->windows.push_back(window);
|
||||
window->show();
|
||||
|
||||
if (type != widgets::Window::Main) {
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QObject::connect(window, &QWidget::destroyed, [this, window] {
|
||||
for (auto it = this->windows.begin(); it != this->windows.end(); it++) {
|
||||
if (*it == window) {
|
||||
this->windows.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return *window;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue