[Kde-bindings] Qt, Qyoto buttons work intermediately

Arno Rehn arno at arnorehn.de
Mon Feb 15 17:15:39 UTC 2010


On Monday 15 February 2010 14:50:47 Richard Dale wrote:
> On Monday 15 February 2010 01:34:09 pm linuxoidoz at yahoo.com.au wrote:
> > Thank you. The menu works perfectly now. But the more I play with the
> > signals/slots, the more I tend to suspect it's completely buggy.
> > 
> > I take proven functions (like ShowAbout) on the very first window which
> > should work, I build the project, click any buttons  - nothing works. I
> > close the window, rebuild the project, everything works. Close the
> > window, rebuild the project, some buttons work, some don't. Rebuild it
> > again - they may work again 2 out of 3 times. Really strange. I thought
> > I was doing something wrong, but this behavior certainly tells me it's
> > not me. Do you get the same problems with working/non-working controls?
> 
> It looks like a garbage collection problem. I don't think it is a problem
> with signals and slots, but if the thing you connected to got garbage
> collected it will mean that any slots in that thing will no longer be
> called. So if a UI element seems to stop working, then see if you can save
> in a variable belonging to the class so that it doesn't get garbage
> collected.
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!

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list