<?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>28432</bug_id>
          
          <creation_ts>2009-08-18 10:46:58 -0700</creation_ts>
          <short_desc>String::createCFString() returns a non-retained empty string</short_desc>
          <delta_ts>2009-08-18 13:02:40 -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>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexey Proskuryakov">ap</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>141128</commentid>
    <comment_count>0</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-08-18 10:46:58 -0700</bug_when>
    <thetext>If String is null, createCFString() returns CFSTR(&quot;&quot;). According to CFString.h, &apos;CFSTR(), not being a &quot;Copy&quot; or &quot;Create&quot; function, does not return a new
reference for you. So, you should not release the return value.&apos;

I am not aware of any practical issues caused by this, but we should probably comply.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>141129</commentid>
    <comment_count>1</comment_count>
      <attachid>35051</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-08-18 10:49:02 -0700</bug_when>
    <thetext>Created attachment 35051
proposed patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>141133</commentid>
    <comment_count>2</comment_count>
      <attachid>35051</attachid>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2009-08-18 11:01:46 -0700</bug_when>
    <thetext>Comment on attachment 35051
proposed patch

&gt; +        * platform/text/cf/StringCF.cpp: (WebCore::String::createCFString): Rather than retain
&gt; +        CFSTR result, we can just return a new string, this doesn&apos;t seem to be a hot code path

Even though it&apos;s not a hot code path it seems like we should avoid the extra memory allocation that CFStringCreateWithCharacters does compared to CFSTR.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>141134</commentid>
    <comment_count>3</comment_count>
      <attachid>35051</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-08-18 11:01:55 -0700</bug_when>
    <thetext>Comment on attachment 35051
proposed patch

If either solution is fine speed-wise, then why not call CFRetain to save memory in case a lot of these strings are kept around?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>141177</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-08-18 13:02:40 -0700</bug_when>
    <thetext>Committed revision 47449.

&gt; If either solution is fine speed-wise, then why not call CFRetain to save
&gt; memory in case a lot of these strings are kept around?

OK, changed. /me doesn&apos;t like to share objects across threads.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>35051</attachid>
            <date>2009-08-18 10:49:02 -0700</date>
            <delta_ts>2009-08-18 11:01:55 -0700</delta_ts>
            <desc>proposed patch</desc>
            <filename>EmptyString.txt</filename>
            <type>text/plain</type>
            <size>1210</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbm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b3JlL3BsYXRmb3JtL3RleHQvY2YvU3RyaW5nQ0YuY3BwCSh3b3JraW5nIGNvcHkp
CkBAIC00NSw3ICs0NSw3IEBAIFN0cmluZzo6U3RyaW5nKENGU3RyaW5nUmVmIHN0cikKIENGU3Ry
aW5nUmVmIFN0cmluZzo6Y3JlYXRlQ0ZTdHJpbmcoKSBjb25zdAogewogICAgIGlmICghbV9pbXBs
KQotICAgICAgICByZXR1cm4gQ0ZTVFIoIiIpOworICAgICAgICByZXR1cm4gQ0ZTdHJpbmdDcmVh
dGVXaXRoQ2hhcmFjdGVycygwLCAwLCAwKTsKIAogICAgIHJldHVybiBtX2ltcGwtPmNyZWF0ZUNG
U3RyaW5nKCk7CiB9Cg==
</data>
<flag name="review"
          id="19237"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>