Program crash: GC destroys an object unexpectedly
eugene
dee0xeed at gmail.com
Sun Sep 19 20:35:38 UTC 2021
On Sunday, 19 September 2021 at 16:27:55 UTC, jfondren wrote:
>
> This is a sufficient patch to prevent the segfault:
>
> ```
> diff --git a/echo_client.d b/echo_client.d
> index 1f8270e..5ec41df 100644
> --- a/echo_client.d
> +++ b/echo_client.d
> @@ -32,7 +32,7 @@ void main(string[] args) {
> sm.run();
> }
>
> - auto stopper = new Stopper();
> + scope stopper = new Stopper();
> stopper.run();
I tried stack allocated stopper in my second 'simple example'
and...
No segfault, but:
http://zed.karelia.ru/0/e/oops.png
As can be seen from the screenshot, destructors of sg0 and sg1
were not called,
but at the very end something went completely wrong.
More information about the Digitalmars-d-learn
mailing list