void QQmlContextData::emitDestruction() { if (!hasEmittedDestruction) { hasEmittedDestruction = true; // Emit the destruction signal - must be emitted before invalidate so that the // context is still valid if bindings or resultant expression evaluation requires it if (engine) { while (componentAttached) { QQmlComponentAttached *a = componentAttached; componentAttached = a->next; if (componentAttached) componentAttached->prev = &componentAttached; a->next = 0; a->prev = 0; emit a->destruction(); } QQmlContextData * child = childContexts; while (child) { child->emitDestruction(); child = child->nextChild; } } } }