[Kde-bindings] Qt, Qyoto buttons work intermediately

Richard Dale rdale at telefonica.net
Mon Feb 15 18:58:25 UTC 2010


On Monday 15 February 2010 06:20:04 pm Robert Riemann wrote:
> > Yes, Richard was right. In your main.cs file your create the MainWindow
> > simply with
> > new MainWindow();
> > but don't save it in a variable. The GC thinks it is now eligible for
> > collection since there are no other references to it anymore.
> > I had already committed a fix a while back that should have prevented
> > visible top-level widgets from being collected, but I didn't cover every
> > possibility. I just committed another fix which makes this works. Thanks
> > for the report!
> 
> I think such kind of fixes should be removed from trunk. Using widgets
> without a reference seems to be dirty coding style to me,
> which doesn't need  to be supported.
Well most Qt language bindings do attempt to support this. For instance, in 
QtRuby during the garbage collection mark phase, the QtRuby runtime traverses 
the QObject heirarchies and marks everything in the trees as still in use. So 
in the case of a QMainWindow, maybe it has the QApplication as a parent, even 
though there isn't an instance of the window live in the application code, it 
can still be treated as a live reference and kept.

> Trying to fixing it would be something like a workaround which isn't
> really necessary imho, but creates overhead.
> 
> I vote for removing these workarounds.
Well it depends what you mean be a workround. I'm not so sure trapping show 
and hide events is a good idea, but at the moment I think the trunk is a good 
place to experiment as we don't have a new KDE release for about six months.

-- Richard

> 
> PS: Please consider I have nearly no idea of good coding style myself.
> Just "speaking" out loud my thoughts...
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings



More information about the Kde-bindings mailing list