MER: Fix memory corruption bug
MER: Fix memory corruption bug

(This patch can be removed when QTBUG-37834 is addressed upstream)

In QQmlData::destroyed(), release the compiledData after
destroying the context instead of before. The context
contains bindings which may contain references to the
compiledData. (At least with V4 bindings)

This might cause heap corruption in QV4Bindings::Binding::disconnect()
because it uses values from 'program' (one of the datas[] values
from a QQmlCompiledData) to possibly modify memory via sub->setActive().

The reads from a freed program are easily reproduced (just start
an app under lipstick and then close it; detected with valgrind).
I haven't witnessed any heap corruption from this but it may be
behind the occasional crashes of lipstick.
(cherry picked from commit 3cfbd9d3176cbbc95bdbe3712f4accdc1485ed55)

matthewvogt/qtdeclarative,matthewvogt/qtdeclarative,matthewvogt/qtdeclarative,matthewvogt/qtdeclarative,matthewvogt/qtdeclarative,matthewvogt/qtdeclarative,matthewvogt/qtdeclarative,matthewvogt/qtdeclarative