Ticket #4875 (closed defect: invalid)

Opened 13 months ago

Last modified 13 months ago

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

Reported by: guest Owned by: peller
Priority: normal Milestone: 1.0
Component: Editor Version: 0.9
Severity: normal Keywords:
Cc: ben.schell@…

Description (last modified by peller) (diff)

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

test_Editor.html (1.9 kB) - added by guest 13 months ago.
Test file showing editor failure

Change History

  Changed 13 months ago by peller

  • owner changed from liucougar to peller
  • description modified (diff)
  • milestone set to 1.0

  Changed 13 months ago by bill

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

  Changed 13 months ago by peller

  • status changed from new to closed
  • resolution set to invalid

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

I suspect destroy() is being called twice.

  Changed 13 months ago by peller

  • status changed from closed to reopened
  • resolution deleted
  • milestone changed from 1.0 to 1.1

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.

  Changed 13 months 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 13 months ago by guest

Test file showing editor failure

follow-up: ↓ 9   Changed 13 months ago by liucougar

  • status changed from reopened to closed
  • resolution set to fixed
  • milestone changed from 1.1 to 1.0

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

  Changed 13 months ago by liucougar

  • status changed from closed to reopened
  • resolution deleted

  Changed 13 months ago by liucougar

  • status changed from reopened to closed
  • resolution set to invalid

in reply to: ↑ 6 ; follow-up: ↓ 10   Changed 13 months 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.

in reply to: ↑ 9   Changed 13 months 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.