Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#1957 closed defect (fixed)

LayoutContainer + TabContainer = strange problem

Reported by: joose Owned by: bill
Priority: high Milestone:
Component: Widgets Version: 0.4
Keywords: LayoutContainer, TabContainer Cc:
Blocked By: Blocking:


Problem: When I have complex layout, when destroying Tab, it causes error in src/widget/html/layout.js

Cause: unknown


--- src/widget/html/layout.js   (revision 6640)
+++ src/widget/html/layout.js   (working copy)
@@ -16,7 +16,6 @@
         * children:
         *              an array like [ {domNode: foo, layoutAlign: "bottom" }, {domNode: bar, layoutAlign: "client"} ]
        dojo.html.addClass(container, "dojoLayoutContainer");
        // Copy children array and remove elements w/out layout.
@@ -60,6 +59,7 @@
                var elm=child.domNode;
                var pos=child.layoutAlign;
                // set elem to upper left corner of unused space; may move it later
+               if (elm == null) {return; }
                        left = f.left+"px";
                        top ="px";

Attachments (1)

test-tabs9.html (1.6 KB) - added by joose 16 years ago.
Test to reproduce the bug (not optimized)

Download all attachments as: .zip

Change History (10)

comment:1 Changed 16 years ago by alex

joose: is this a dupe of #1957?

comment:2 Changed 16 years ago by bill

I think Alex means, "Is this a dup of #1952?". You said there that it's a different bug. Hmm, I can't really check in this code. It's a workaround to a problem in another piece of code; I want to fix the original code.

comment:3 Changed 16 years ago by joose

No, this is not dupe of #1952.

I originally ment #1952 to be this bug, but when I created test case I found new bug which I reported in #1952. Still, I have not been able to create test case for this bug, so cause is still unknown.

comment:4 Changed 16 years ago by joose

Ok, I attached a test-case which reproduces the bug.

How to do it: close the tab

Changed 16 years ago by joose

Attachment: test-tabs9.html added

Test to reproduce the bug (not optimized)

comment:5 Changed 16 years ago by joose

And forgot to say this: the src/widget/html/layout.js is called from LayoutContainer?.js

comment:6 Changed 16 years ago by alex

(In [6656]) band aid. Refs #1957. Will leave it to bill to make the call as to whether or not a more comprehensive fix is necessaray.

comment:7 Changed 16 years ago by bill

This happens because calling childWidget.destroy() deletes childWidget.domNode (and other resources the child is using), but the child is still listed in the parent's this.children[] array. (The above fix just masks the problem.)

comment:8 Changed 16 years ago by bill

Resolution: fixed
Status: newclosed

(In [6670]) Fix dangling references after calling myWidget.destroy() when myWidget is attached to a parent widget. Rollback [6656] which was a workaround to this bug.

Fixes #1957.

comment:9 Changed 15 years ago by (none)

Milestone: 0.4.1

Milestone 0.4.1 deleted

Note: See TracTickets for help on using tickets.