In QML, I'm using a C++ library that returns a QObject that does a process and emits a signal when is done. In javascript, I use the connect method of the signal being emitted (success) to attach an anonymous function that should handle the signal as the following piece of code shows:
var requestResponse = apiClient.execute(reqInp);
requestResponse.success.connect(function success(response) 
{
        var requestResponseJSON = JSON.parse(response.responseAsJsonString());
        this.append(response.responseAsJsonString());
});
My problem is that sometimes the QML item that contains this method is destroyed before the C++ code being able to complete, so when the signal is emitted, the anonymous function causes an error, because it calls methods that are undefined (in my example, the method append). I have some nasty crashes in iOS and I suspect that this is what might be causing it. 
Is there a way of force disconnection of the signal when the object that created the function is destroyed?