Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <!-- |
michael@0 | 3 | Program received signal SIGSEGV, Segmentation fault. |
michael@0 | 4 | 0xb6457185 in nsIContent::SetAttr (this=0x0, aNameSpaceID=0, aName=0xb0cb064c, aValue=..., aNotify=1) at ../../dist/include/nsIContent.h:285 |
michael@0 | 5 | 285 return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify); |
michael@0 | 6 | (gdb) p this |
michael@0 | 7 | $6 = (nsIContent * const) 0x0 |
michael@0 | 8 | (gdb) bt 3 |
michael@0 | 9 | #0 0xb6457185 in nsIContent::SetAttr (this=0x0, aNameSpaceID=0, aName=0xb0cb064c, aValue=..., aNotify=1) at ../../dist/include/nsIContent.h:285 |
michael@0 | 10 | #1 0xb6b72072 in nsTreeColumns::RestoreNaturalOrder (this=0xaaf83cc0) at layout/xul/base/src/tree/src/nsTreeColumns.cpp:605 |
michael@0 | 11 | #2 0xb736c76f in NS_InvokeByIndex_P () at xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp:69 |
michael@0 | 12 | (More stack frames follow...) |
michael@0 | 13 | (gdb) frame 1 |
michael@0 | 14 | #1 0xb6b72072 in nsTreeColumns::RestoreNaturalOrder (this=0xaaf83cc0) at layout/xul/base/src/tree/src/nsTreeColumns.cpp:605 |
michael@0 | 15 | 605 child->SetAttr(kNameSpaceID_None, nsGkAtoms::ordinal, ordinal, PR_TRUE); |
michael@0 | 16 | (gdb) list |
michael@0 | 17 | 600 PRUint32 numChildren = colsContent->GetChildCount(); |
michael@0 | 18 | 601 for (PRUint32 i = 0; i < numChildren; ++i) { |
michael@0 | 19 | 602 nsIContent *child = colsContent->GetChildAt(i); |
michael@0 | 20 | 603 nsAutoString ordinal; |
michael@0 | 21 | 604 ordinal.AppendInt(i); |
michael@0 | 22 | 605 child->SetAttr(kNameSpaceID_None, nsGkAtoms::ordinal, ordinal, PR_TRUE); |
michael@0 | 23 | 606 } |
michael@0 | 24 | (gdb) p child |
michael@0 | 25 | $7 = (nsIContent *) 0x0 |
michael@0 | 26 | |
michael@0 | 27 | First loop iteration: |child->SetAttr()| dispatches "DOMAttrModified" event. |
michael@0 | 28 | Event listener removes next column. Second loop iteration: |colsContent->GetChildAt(i)| |
michael@0 | 29 | returns null. Then we have |null->SetAttr()|. |
michael@0 | 30 | --> |
michael@0 | 31 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 32 | onload="run();"> |
michael@0 | 33 | <tree id="tree"> |
michael@0 | 34 | <treecols> |
michael@0 | 35 | <treecol id="col1"/> |
michael@0 | 36 | <treecol id="col2"/> |
michael@0 | 37 | </treecols> |
michael@0 | 38 | <treechildren/> |
michael@0 | 39 | </tree> |
michael@0 | 40 | <script type="text/javascript"><![CDATA[ |
michael@0 | 41 | function listener() { |
michael@0 | 42 | var col2 = document.getElementById("col2"); |
michael@0 | 43 | col2.parentNode.removeChild(col2); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | function run() { |
michael@0 | 47 | var col1 = document.getElementById("col1"); |
michael@0 | 48 | col1.addEventListener("DOMAttrModified", listener, true); |
michael@0 | 49 | var tree = document.getElementById("tree"); |
michael@0 | 50 | tree.columns.restoreNaturalOrder(); |
michael@0 | 51 | } |
michael@0 | 52 | ]]></script> |
michael@0 | 53 | </window> |
michael@0 | 54 |