core: derive incubation controllers from tracked windows list

Replaces the attempts to track incubation controllers directly with a
list of all known windows, then pulls the first usable incubation
controller when an assignment is requested.

This should finally fix incubation controller related use after free crashes.
This commit is contained in:
outfoxxed 2025-09-19 00:16:26 -07:00
parent 59f5744f30
commit e9a574d919
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
3 changed files with 27 additions and 103 deletions

View file

@ -153,13 +153,7 @@ void ProxyWindowBase::createWindow() {
void ProxyWindowBase::deleteWindow(bool keepItemOwnership) {
if (this->window != nullptr) emit this->windowDestroyed();
if (auto* window = this->disownWindow(keepItemOwnership)) {
if (auto* generation = EngineGeneration::findObjectGeneration(this)) {
generation->deregisterIncubationController(window->incubationController());
}
window->deleteLater();
}
if (auto* window = this->disownWindow(keepItemOwnership)) window->deleteLater();
}
ProxiedWindow* ProxyWindowBase::disownWindow(bool keepItemOwnership) {
@ -185,7 +179,7 @@ void ProxyWindowBase::connectWindow() {
if (auto* generation = EngineGeneration::findObjectGeneration(this)) {
// All windows have effectively the same incubation controller so it dosen't matter
// which window it belongs to. We do want to replace the delay one though.
generation->registerIncubationController(this->window->incubationController());
generation->trackWindowIncubationController(this->window);
}
this->window->setProxy(this);