<?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>7398</bug_id>
          
          <creation_ts>2006-02-20 22:58:03 -0800</creation_ts>
          <short_desc>Crash in setFocusNode if the old focus node has been detached</short_desc>
          <delta_ts>2006-02-20 23:59:30 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>7363</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Graham Dennis">Graham.Dennis</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mitz</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>33563</commentid>
    <comment_count>0</comment_count>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-02-20 22:58:03 -0800</bug_when>
    <thetext>While running Sandvox with the latest WebKit ToT, if one deletes all the text in the site sub-title or &apos;parting words&apos; editable divs, then the editing delegate (in Sandvox) removes the text element (it becomes detached) before setFocusNode() is called. When setFocusNode is called, there is a crash caused by the assumption that if the node exists, and it isn&apos;t currently being detached, that is must have a renderer. In this case, as it has been detached, it no longer has a renderer. I have a patch which I&apos;ll attach.

The appropriate part of the crash report is below:
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0   com.apple.WebCore              	0x019bcb50 WebCore::DocumentImpl::setFocusNode(KXMLCore::PassRefPtr&lt;WebCore::NodeImpl&gt;) + 400 (DocumentImpl.cpp:2058)
1   com.apple.WebCore              	0x019b53a8 WebCore::FrameView::dispatchMouseEvent(WebCore::AtomicString const&amp;, WebCore::NodeImpl*, bool, int, QMouseEvent*, bool, int) + 1208 (FrameView.cpp:1038)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33564</commentid>
    <comment_count>1</comment_count>
      <attachid>6637</attachid>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-02-20 22:59:46 -0800</bug_when>
    <thetext>Created attachment 6637
patch

This patch seems to fix the bug for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33565</commentid>
    <comment_count>2</comment_count>
      <attachid>6637</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2006-02-20 23:02:17 -0800</bug_when>
    <thetext>Comment on attachment 6637
patch

Patch looks good. We need a layout test for regression-testing purposes and a change log entry.

Also, did you run all the other layout tests to check that this didn&apos;t break anything?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33568</commentid>
    <comment_count>3</comment_count>
    <who name="">mitz</who>
    <bug_when>2006-02-20 23:06:27 -0800</bug_when>
    <thetext>Is this a duplicate of bug 7363?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33581</commentid>
    <comment_count>4</comment_count>
    <who name="Graham Dennis">Graham.Dennis</who>
    <bug_when>2006-02-20 23:59:30 -0800</bug_when>
    <thetext>The crash occurs on the same line as 7363, but this patch won&apos;t fix 7363 as in this case, the node is detached and so doesn&apos;t have a renderer. In the other case, the node is attached but still doesn&apos;t have a renderer.

*** This bug has been marked as a duplicate of 7363 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>6637</attachid>
            <date>2006-02-20 22:59:46 -0800</date>
            <delta_ts>2006-02-20 23:02:17 -0800</delta_ts>
            <desc>patch</desc>
            <filename>setFocusNodeCrash.diff</filename>
            <type>text/plain</type>
            <size>597</size>
            <attacher name="Graham Dennis">Graham.Dennis</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvZG9tL0RvY3VtZW50SW1wbC5jcHAKPT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gV2ViQ29y
ZS9kb20vRG9jdW1lbnRJbXBsLmNwcAkocmV2aXNpb24gMTI5MDMpCisrKyBXZWJDb3JlL2RvbS9E
b2N1bWVudEltcGwuY3BwCSh3b3JraW5nIGNvcHkpCkBAIC0yMDQ3LDcgKzIwNDcsNyBAQCBib29s
IERvY3VtZW50SW1wbDo6c2V0Rm9jdXNOb2RlKFBhc3NSZWZQCiAgICAgY2xlYXJTZWxlY3Rpb25J
Zk5lZWRlZChuZXdGb2N1c05vZGUuZ2V0KCkpOwogCiAgICAgLy8gUmVtb3ZlIGZvY3VzIGZyb20g
dGhlIGV4aXN0aW5nIGZvY3VzIG5vZGUgKGlmIGFueSkKLSAgICBpZiAob2xkRm9jdXNOb2RlICYm
ICFvbGRGb2N1c05vZGUtPm1faW5EZXRhY2gpIHsgCisgICAgaWYgKG9sZEZvY3VzTm9kZSAmJiBv
bGRGb2N1c05vZGUtPmF0dGFjaGVkKCkgJiYgIW9sZEZvY3VzTm9kZS0+bV9pbkRldGFjaCkgeyAK
ICAgICAgICAgaWYgKG9sZEZvY3VzTm9kZS0+YWN0aXZlKCkpCiAgICAgICAgICAgICBvbGRGb2N1
c05vZGUtPnNldEFjdGl2ZShmYWxzZSk7CiAK
</data>
<flag name="review"
          id="1663"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>