<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>20317</bug_id>
          
          <creation_ts>2008-08-07 06:19:15 -0700</creation_ts>
          <short_desc>[GTK] Add smart pointers for GTK use</short_desc>
          <delta_ts>2008-09-05 08:08:44 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>20483</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Gtk</keywords>
          <priority>P2</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Marco Barisione">marco.barisione</reporter>
          <assigned_to name="Marco Barisione">marco.barisione</assigned_to>
          <cc>jonathon</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>88034</commentid>
    <comment_count>0</comment_count>
    <who name="Marco Barisione">marco.barisione</who>
    <bug_when>2008-08-07 06:19:15 -0700</bug_when>
    <thetext>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 &lt;typename T, freeFunction=g_free&gt; class GOwnPtr : Noncopyable { ... };
typedef GOwnPtr&lt;gchar*&gt; GCharPtr; // most of the times we are dealing with chars
template &lt;typename T=GObject*&gt; 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++.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90267</commentid>
    <comment_count>1</comment_count>
    <who name="Marco Barisione">marco.barisione</who>
    <bug_when>2008-09-05 08:08:44 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 20483 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>