Fix possible stack overflow with many property bindings
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Mon, 13 Jul 2015 12:57:16 +0000 (14:57 +0200)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Tue, 21 Jul 2015 12:04:27 +0000 (12:04 +0000)
commit40b9fb8946837a01710814c28fd0f04edba631ad
tree37ab859f436870e1add2f028b671caffede3f21e
parent96c35a84d30b5b5cdf8feac4959891ad0bfed6a8
Fix possible stack overflow with many property bindings

When there are a lot of bindings to the same property (like 20 000),
we would get stack overflows because the notify list for the
changed signal was traversed recursively.

Changing this also speeds up the traversal. I see something like
~40% reduction in the case of layout() for a notify list of around
200 items.

Note: To make it possible to traverse the double-linked list backwards,
the next-pointer needs to be moved to the beginning of the struct,
because the implementation pattern assumes this
(node->next->prev = &node->next).

I think this code has rotted after it was added, since the prev pointer
was never actually used anywhere before.

Change-Id: Icdfac50b7c8584a908efa65694c7f5f416cb153b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
src/qml/qml/qqmlengine.cpp
src/qml/qml/qqmlnotifier.cpp
src/qml/qml/qqmlnotifier_p.h
tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp