Program crash: GC destroys an object unexpectedly

eugene dee0xeed at gmail.com
Tue Sep 14 11:31:18 UTC 2021


On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
> Then after pressing ^C (SIGINT) the program gets SIGSEGV, since 
> references to sg0 and sg1 are no longer valid (they are 
> "sitting" in epoll_event structure).

... forget to mention, crashes here:

```d
     bool wait() {

         const int maxEvents = 8;
         EpollEvent[maxEvents] events;

         if (done)
             return false;

         int n = epoll_wait(id, events.ptr, maxEvents, -1);
         if (-1 == n)
             return false;

         foreach (k; 0 .. n) {
             EventSource s = events[k].es;
             ulong ecode = s.eventCode(events[k].event_mask); // 
<<<<< SIGSEGV
```

sg0/sg1 are destroyed, so s points to wrong location.




More information about the Digitalmars-d-learn mailing list