[Kde-bindings] playground/bindings/kimono
Richard Dale
rdale at foton.es
Thu Mar 22 20:44:10 UTC 2007
On Thursday 22 March 2007, Richard Dale wrote:
> * Hmm, a fix for a GCHandle leak stopped custom slots from working for
> no apparent reason.
Ah, found it - I fixed the GCHandle leaks which meant that there were no
references to the LCDRange instances. Then references to LCDRange class
instances were being freed from the weak reference map because they didn't
have a parent at the time they were constructed. The IsContainedInstance()
test is only tested at construction time and consequently references to the
LCDRange weren't added to the strong reference map. And so when a custom slot
was invoked on an LCDRange it couldn't be found via the weak reference map.
// No parent here:
LCDRange angle = new LCDRange(Tr("ANGLE"));
...
QVBoxLayout leftLayout = new QVBoxLayout();
leftLayout.AddWidget(angle);
...
QGridLayout gridLayout = new QGridLayout();
gridLayout.AddLayout(leftLayout, 1, 0);
...
// angle finally gets a parent
SetLayout(gridLayout);
So as far as I can see this is quite tricky to fix. If we added the PyQt SIP
annotations even, as far as I can see it would need to do runtime checks on
the children of the GameBoard widget at the point of the SetLayout() call.
-- Richard
More information about the Kde-bindings
mailing list