Program crash: GC destroys an object unexpectedly
eugene
dee0xeed at gmail.com
Sun Sep 19 13:59:04 UTC 2021
On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
> The instance of Stopper is created in the scope of main():
>
> ```d
> void main(string[] args) {
>
> auto stopper = new Stopper();
> stopper.run();
> ```
Look...
I have added stopper into an array...
```d
Stopper[] stoppers;
auto stopper = new Stopper();
stoppers ~= stopper;
stopper.run();
```
and, you won't believe, this have fixed the problem -
the objects, referenced by sg0 and sg1 are not destroyed anymore.
This is much more acceptable 'solition' for me than adding
all of that bunch of event sources into some array.
But I'am still puzzled - what is so special in the stopper?
echo-server has it 'reception' just as single variable
and it works fine.
More information about the Digitalmars-d-learn
mailing list