[Development] QtCS - QtCore discussion

Olivier Goffart olivier at woboq.com
Thu Aug 22 16:44:53 CEST 2013

On Thursday 22 August 2013 16:15:13 Milian Wolff wrote:
> Hello!
> On Friday 26 July 2013 13:37:01 Thiago Macieira wrote:
> > - exception-safety: we discussed a bit and we ended up concluding that:
> > 	=> we will roll back exception safety support in all of Qt <=
> > 	
> >   that is, we will stop promising any level of exception safety, even in
> >   the
> > 
> > tools classes.
> We were asked this yesterday and wanted to ask for clarification of this
> point. While many points in Qt are plain impossible to be fixed when
> exceptions are thrown in some cases (e.g. containers etc.), what about such
> cases like throwing an exception in a slot which is mentioned in the wiki
> (which apparently crashes)? In general, would it be accepted to add more
> RAII patterns to Qt codebases where appropriate to guard against exception
> safety issues?

As far as I am concerned, throwing an exception from a slot which is connected 
with a DirrectConnection to the signal should work. The exception is 
propagated to the signal and if there was more slot connected, further slot 
would not be called.

At least it used to work.  But Thiago has been against officially supporting it, 
and removed it from the documentation.  Also that is not very well tested.

See the discussion in this doc patch  https://codereview.qt-project.org/41179
> Generally, I assume it's OK for a developer using Qt to throw exceptions.
> But at what point is he required to catch? What are the guidelines here?
> Must he ensure that no exceptions are thrown across Qt functions? I.e.
> never throw from a slot? I'd welcome if this could be clearly communicated
> somewhere in the documentation. People will use exceptions and they will
> run into problems when using Qt, so this must be clarified imo.

I guess the new policy should be:
 "Don't let exceptions cross Qt boundaries" 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org

More information about the Development mailing list