Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8029277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:23:15+00:00 2026-06-05T00:23:15+00:00

I’m facing with what looks like a zombie reference case. First off, this is

  • 0

I’m facing with what looks like a zombie reference case.

First off, this is the code I’m working with.

Here you’ll find my User’s details manager layout gist

The controller, instead, can be found here

The flow of operations is as follow:

  1. Admin access the list of users upon hitting the route that calls “manageUsers” on the controller.
  2. Admin clicks on a user row and the event “users:selected” gets triggered and the listener recevies the user instance to work with.
  3. DetailsLayout gets instantiated and rendered in the application’s main layout. Specifically
    in its “content” region.
  4. The view that deals with user details form gets instantiated too and rendered inside
    DetailsLayout’s “dettagli” region.
  5. At this point, the administrator is interested in managing this user’s notes. So he clicks
    on the tab labeled “notes” and the list of notes gets rendered in the DetailsLayout “note” region.
  6. Clicking on the note the administrator wants to work with fires the event “notes:selected” which passes the note instance to the appropriate event handler (DetailsLayout.showNote).

At this point once the administrator clicks on the link that fires DetailsLayout.showUsers which, in turn fires the event “users:index” listened by the afore mentioned controller, he
gets back to point 1 of the list above.

Repeating the whole process up to point 5 works as expected but, as soon as the administrator
picks the note to work the debugger shows an error about the DetailsLayout region “note” not being defined.

Running through the code step by step I have found that on the second run the events fired are
correctly bound to the proper instance of DetailsLayout except for the point 6 which is still bound to the instance used on first pass.

The code above shows that each and every time the user’s details are shown a new instance of DetailsLayout gets created. Shouldn’t this be enough to guarantee that no zombies are still around? If I recall correctly from backbone.marionette documentation, each time layout.region.show() gets hit, it closes the previous view (unbinding events and all the rest) and attaches the newly passwed view.

What’s that I’m doing the wrong way?

Thanks in advance for your help.
Regards

P.S.

Backbone.marionette version is 0.8.4

Backbonejs version is 0.9.2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:23:17+00:00Added an answer on June 5, 2026 at 12:23 am

    Your constructor in the UserDetailsList is the problem:

                constructor: (@user) ->
                    console.addHistory("DetailsLayout","INIT")
                    super()
                    Hub.vent.on("notes:selected",(note) => @showNote(note))
                    Hub.vent.on("notes:show", => @showNotes())
                    Hub.vent.on("notes:save", (note) => @saveNote(note))
                    Hub.vent.on("notes:delete", (note) => @deleteNote(note))
                    Hub.vent.on("notes:new", => @showNote(new Note()))
    

    You’re directly binding to the Hub.vent but never explictly unbinding from these events. Therefore, your instance of UserDetails list is hanging around in memory forever.

    To fix this, you should use the layout’s bindTo method which will track the binding and unbind it for you when the layout’s close method is called.

                constructor: (@user) ->
                    console.addHistory("DetailsLayout","INIT")
                    super()
                    @bindTo(Hub.vent, "notes:selected",(note) => @showNote(note))
                    @bindTo(Hub.vent, "notes:show", => @showNotes())
                    @bindTo(Hub.vent, "notes:save", (note) => @saveNote(note))
                    @bindTo(Hub.vent, "notes:delete", (note) => @deleteNote(note))
                    @bindTo(Hub.vent, "notes:new", => @showNote(new Note()))
    

    Be sure to correctly close your layout when you no longer need it. Call the close method on your layout instance. This will correctly clean up all of the bindTo events that the constructor set up.

    FYI – a Layout extends directly from ItemView so all of the information / documentation about an ItemView also applies to a Layout, including the use of bindTo, close, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.