Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 08, 2019 [Issue 20285] Struct destructor called multiple times in dynamic arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20285 kinke <kinke@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kinke@gmx.net --- Comment #1 from kinke <kinke@gmx.net> --- This shows better what's going on: void main() { Foo[] array; array.length = 1; array[0] = Foo(1); printf("1st pointer: %p\n", array.ptr); array.length = 2; array[1] = Foo(2); printf("2nd pointer: %p\n", array.ptr); } => Destroying foo 0 1st pointer: 0x7f9cf69b3000 Destroying foo 0 2nd pointer: 0x7f9cf69b4000 Destroying foo 1 Destroying foo 2 Destroying foo 1 Increasing the length default-constructs instances at the end, which are destructed when assigning the literals later. These are the first 2 dtor calls. As a reallocation takes places, the two GC arrays are destructed on program termination, these are the other 3 dtor calls. Here, the 1st 1-element-array should probably not be destructed, as it's been moved from (and it hasn't been reset to T.init either). -- |
October 09, 2019 [Issue 20285] Struct destructor called multiple times in dynamic arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20285 Max Samukha <maxsamukha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxsamukha@gmail.com --- Comment #2 from Max Samukha <maxsamukha@gmail.com> --- Bugs like this should not be marked normal. They are critical at least. -- |
December 17, 2022 [Issue 20285] Struct destructor called multiple times in dynamic arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20285 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 07 [Issue 20285] Struct destructor called multiple times in dynamic arrays | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20285 --- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17391 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation