[Qt-interest] The dangers of removePostedEvents?

Mihail Naydenov mlists at ymail.com
Mon Dec 6 17:31:33 CET 2010


I am trying to implement cancellation of work sent to a thread using (only) 
signals and slots method. (object movedToThread, slots do work and emit results 
back)

My problem is if I queue many events I have hard time forcing it to handle only 
the last one, discarding all previous. 

(Though I already use a cancel flag, I fail to find a way to set and restore it 
the right way, the above to happen. Another issue is that most of the work 
itself is not cancelable, so it mainly handles stuff, like "don't start it" or 
"don't sent the result" )
removePostedEvents seams to work like a charm, in conjunction with a cancel 
flag, removing QEvent::MetaCall-s I have sent.


Thanks
MihailNaydenov



----- Original Message ----
> From: Scott Aron Bloom <Scott.Bloom at onshorecs.com>
> To: qt-interest at trolltech.com
> Sent: Mon, December 6, 2010 12:25:44 PM
> Subject: Re: [Qt-interest] The dangers of removePostedEvents?
> 
> Well..  Without knowing why you would use this... its hard to give  any
> advice...
> 
> Can you give a code sample showing the problem you are  having that you
> are saying can only be solved with  removepostedEvents?
> 
> 
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com]  On Behalf Of Mihail Naydenov
> Sent: Monday, December 06, 2010 2:18 AM
> To: qt-interest at trolltech.com
> Subject:  Re: [Qt-interest] The dangers of  removePostedEvents?
> 
> Anyone?
> 
> Thank  You
> MihailNaydenov
> 
> 
> 
> ----- Original Message ----
> > From:  Mihail Naydenov <mlists at ymail.com>
> > To: qt-interest at trolltech.com
> >  Sent: Mon, November 29, 2010 11:53:10 AM
> > Subject: [Qt-interest] The  dangers of removePostedEvents?
> > 
> > Hello,
> > I ended up using  QApplicstion::removePostedEvents, but the docs advice
> not 
> to.
> > 
> > "...You should never need to call this function. If you do call   it,
> be aware 
> > that killing events may cause receiver to break one or  more
> invariants."
> > 
> > Please explain this section to me, what  are the real dangers  I might
> run 
> into?
> > Thus far I found  that removePostedEvents is *exactly* what  I need,
> and my 
> >  program behaves best when using it, 
> > 
> > but I am a bit   frightened by this warning.
> > 
> > Thank you in  advance.
> >  MihailNaydenov
> > 
> > 
> > 
> >      
> >  _______________________________________________
> > Qt-interest  mailing  list
> > Qt-interest at trolltech.com
> >  http://lists.trolltech.com/mailman/listinfo/qt-interest
> > 
> 
> 
>       
> _______________________________________________
> Qt-interest mailing  list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 
> _______________________________________________
> Qt-interest  mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 


      



More information about the Qt-interest-old mailing list