Bug 154941

Summary: Improve exception safety with smart pointers
Product: [Applications] digikam Reporter: Markus Elfring <Markus.Elfring>
Component: Portability-RuntimeAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: caulier.gilles, finex, marcel.wiesweg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 7.6.0

Comment 1 caulier.gilles 2008-01-01 21:28:52 UTC
Markus,

Are you talking about data pointer used in 'd' private container class ?

Gilles Caulier
Comment 2 Markus Elfring 2008-01-04 20:22:14 UTC
Yes ...
I see the following attributes as candidates for encapsulation.
- d
- m_backwardStack
- m_forwardStack

Will window objects delete themselves?

Comment 3 caulier.gilles 2008-01-04 21:40:12 UTC
yes Qt object are deleted automaticly by Qt lib (like Java do).

d container is deleted in destructor of main class...

So no need to manage anymore. Valgrind do not report any memory leak here...

Gilles Caulier
Comment 4 Markus Elfring 2008-01-04 22:13:21 UTC
I doubt that the first AlbumStack object will be properly deleted if the second allocation will throw an exception in the AlbumHistory constructor.

How do you think about the chance to omit explicit delete instructions?
http://www.gotw.ca/publications/using_auto_ptr_effectively.htm
Comment 5 caulier.gilles 2008-03-18 12:46:52 UTC
Marcel,

What do you think about this entry. It's still valid ?

Gilles Caulier
Comment 6 Marcel Wiesweg 2008-03-18 17:58:18 UTC
I think it's KDE style to rely on QObject mechanims for auto-deletion.
We dont use exceptions (or catch them from libexiv2), so we won't throw any in constructors.
Other than that, I am not familiar with std::auto_ptr
Comment 7 caulier.gilles 2008-03-18 18:04:38 UTC
I'm agree with you Marcel. So i close this file...

Gilles
Comment 8 Markus Elfring 2008-12-16 15:03:34 UTC
Would you like to apply the template class "QSharedPointer" in the near future?
http://doc.trolltech.com/main-snapshot/qsharedpointer.html#details
Comment 9 Marcel Wiesweg 2008-12-16 17:34:06 UTC
We use QSharedDataPointer in some appropriate places. We have no intended use for QSharedPointer at the moment.
Comment 10 Markus Elfring 2008-12-16 19:02:47 UTC
Will Qt 4.5 become generally available with the class "QSharedPointer" in the next year?   ;-)