RESOLVED DUPLICATE of bug 20483 Bug 20317
[GTK] Add smart pointers for GTK use
https://bugs.webkit.org/show_bug.cgi?id=20317
Summary [GTK] Add smart pointers for GTK use
Marco Barisione
Reported 2008-08-07 06:19:15 PDT
It would be useful to have some smart pointers to be used in the GTK port to reduce memory leaks and code complexity. We should need at least a OwnPtr-like class for pointers and a ref ptr for gobjects. I can see two possibilities: modifying OwnPtr and RefPtr for our needs or add new classes. The first solution could be a bit tricky so I think we could add something like: template <typename T, freeFunction=g_free> class GOwnPtr : Noncopyable { ... }; typedef GOwnPtr<gchar*> GCharPtr; // most of the times we are dealing with chars template <typename T=GObject*> class GObjectPtr { ... }; What do you think? Before starting to write anything I would like to hear the opinion of people more expert than me on C++.
Attachments
Marco Barisione
Comment 1 2008-09-05 08:08:44 PDT
*** This bug has been marked as a duplicate of 20483 ***
Note You need to log in before you can comment on or make changes to this bug.