Access Python QObject from QML fails to convert on second call
<p>I am hitting an obscure problem (bug?) with my Python3 QML program.
I implemented a QAbstractListModel with a custom get method to get to the underlying QObject items. The moment I try to get the same Python QObject at two different places in QML I get:</p>

<pre><code>TypeError: unable to convert a Python 'QMyItem' object to a C++ 'QObject*' instance
</code></pre>

<p>The get method looks like this:</p>

<pre><code>@pyqtSlot(int, result=QMyItem)
def get(self, row):
    return self._items[row]
</code></pre>

<p>And the model like this:</p>

<pre><code>ComboBox {
    model: mymodel
    textRole: 'name'
    onActivated: mymodel.item = model.get(index)
    onModelChanged: currentIndex = getCurrentIndex(mymodel, mymodel.item)
}
</code></pre>

<p>The problem is actually unrelated to the way I retrieve the QObject. It really seems to be about the Python to QML conversion. As if the converter keeps a list of already passed references and gets out of sync somehow.</p>

<p><strong>I now have a minimal sample which shows the error.</strong> Get the source from <a href="https://github.com/sturmf/python_samples.git">https://github.com/sturmf/python_samples.git</a> and go into the folder <code>pyqt_combobox_qabstractlistmodel</code>. In there start the sample with <code>python3 main.py</code>. In the shown ComboBox see that you can select item <code>three</code> but item <code>one</code> gives you an error on the console. The reason is that item one was already once passed from Python to QML and it doesn't work a second time.</p>

<p>Maybe the converted QObject got somehow garbage collected on the QML side?</p>