[Interest] Where to catch exception when a qml plugin is loaded? Even possible?

wargand at gmx.de wargand at gmx.de
Thu Apr 26 11:05:19 CEST 2012


> The solution is simple: nothing is required.
>
> If the constructor throws, the language calls operator
> delete. There's no leak. You can confirm by inspecting the assembly
> of the following program:
>
> struct Foo { Foo(); }; Foo *f() { return new Foo; }
>
> You'll notice that the body of the function f() contains at least
> one call to operator delete().

I still prefer smart pointers. Less hassle to think it through if there
really isn't a way that an object in one of the base classes isn't 
destroyed correctly. Especially since the destructor of the class,
which throws in the constructor isn't called. Better safe than sorry.

Guido



More information about the Interest mailing list