[r116] Changing layout and 'on destroyed'

Bugs will be moved here once resolved.

Post » Sat Jan 26, 2013 7:29 pm

Link to .capx file (required!):
changeLayoutOnDestroy.capx

Steps to reproduce:
1. Press SPACE a few times to switch between layout 1 and 2.

Observed result:
Switching layout destroys all sprites on the layout 1, which calls their 'on destroyed' event, which then spawns new objects on layout 2.

Expected result:
Layout 2 should be empty, layout 1 should only have 4 visible sprites.

Browsers affected:
Chrome: yes
Firefox: yes
Internet Explorer: yes

Operating system & service pack: Win 7 Home Premium x64 - SP 1

Construct 2 version: r116
    
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Mon Jan 28, 2013 3:05 pm

This particular .capx is impossible to resolve. When 'Sprite' is destroyed at the end of a layout, if the object it creates is then also destroyed because it's the end of the layout, then you get an infinite loop (Sprite2 is destroyed, which creates a Sprite which is destroyed, which creates a Sprite2 which is destroyed...)

Therefore objects created when the layout is ending must not be destroyed.

Workaround: use a global variable or flag to disable object creation when changing layout.

Closing as won't fix.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests