Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4875 closed defect (invalid)

Calling editor.destroy() results in an error being thrown (related to #3726)

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 1.0
Component: Editor Version: 0.9
Keywords: Cc: ben.schell@…
Blocked By: Blocking:

Description (last modified by Adam Peller)

The line checked in for #3726 (Changeset [10810]) throws an error:

this.toolbar has no properties

Currently, the line is:

this.toolbar.destroy(); delete this.toolbar;

Commenting out the second half of the line, like so:

this.toolbar.destroy(); //delete this.toolbar;

fixes the error.

Attachments (1)

test_Editor.html (1.9 KB) - added by guest 12 years ago.
Test file showing editor failure

Download all attachments as: .zip

Change History (11)

comment:1 Changed 12 years ago by Adam Peller

Description: modified (diff)
Milestone: 1.0
Owner: changed from liucougar to Adam Peller

comment:2 Changed 12 years ago by bill

Any idea why the delete call fails? I guess we can just comment it out but it's mysterious.

comment:3 Changed 12 years ago by Adam Peller

Resolution: invalid
Status: newclosed

Please attach code to reproduce this and whether it is dependent on platform, etc.

I suspect destroy() is being called twice.

comment:4 Changed 12 years ago by Adam Peller

Milestone: 1.01.1
Resolution: invalid
Status: closedreopened

take another look in 1.1. Ben says he was calling destroyDescendants() and destroy(). If that's a valid thing to do, we should check toolbar before destroying it.

comment:5 Changed 12 years ago by guest

I'm attaching a test file that demonstrates the behavior. Obviously this isn't very critical, but it does work for Textarea and TextBox?. I'm not quite sure that my order of operations is 'valid', so this could still be an invalid issue.

Changed 12 years ago by guest

Attachment: test_Editor.html added

Test file showing editor failure

comment:6 Changed 12 years ago by liucougar

Milestone: 1.11.0
Resolution: fixed
Status: reopenedclosed

this.destroyDescendants() destroys textarea, textbox and edtior, so you don't need to call destroy on all of them separately again

in addition, I don't think you need your custom clear() function at all, just call destroyRecursive(), it should do all the work for you

mark as invalid

comment:7 Changed 12 years ago by liucougar

Resolution: fixed
Status: closedreopened

comment:8 Changed 12 years ago by liucougar

Resolution: invalid
Status: reopenedclosed

comment:9 in reply to:  6 ; Changed 12 years ago by guest

Replying to liucougar:

this.destroyDescendants() destroys textarea, textbox and edtior, so you don't need to call destroy on all of them separately again

in addition, I don't think you need your custom clear() function at all, just call destroyRecursive(), it should do all the work for you

mark as invalid

But that's entirely my point. The textarea, textbox, and editor are NOT being destroyed by destroyDescendants. For some reason only the Editor's toolbar is being destroyed. This seems like odd behavior.

Additionally, calling destroyRecursive() destroys the entire widget. In this instance, that is not the desired behavior, I simply wanted to ensure I've destroyed any child widgets that I've programmatically created.

Again, I'm not claiming this particular issue is valid, but it does seem like there is a bug *somewhere* in all of this. Why some widgets (the Editor's toolbar) are destroyed and some aren't by destroyDescendants is really my question.

comment:10 in reply to:  9 Changed 12 years ago by bill

Replying to guest:

But that's entirely my point. The textarea, textbox, and editor are NOT being destroyed by destroyDescendants.

Textarea, textbox, and editor are being destroyed by destroyDescendants(). It's just that you are left with stray pointers (this.textbox, etc.) to those destroyed widgets.

Note: See TracTickets for help on using tickets.