Bug 154941 - Improve exception safety with smart pointers
Summary: Improve exception safety with smart pointers
Status: RESOLVED NOT A BUG
Alias: None
Product: digikam
Classification: Applications
Component: Portability-Runtime (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-01 20:54 UTC by Markus Elfring
Modified: 2022-01-23 11:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.6.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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?   ;-)