Program crash: GC destroys an object unexpectedly

eugene dee0xeed at gmail.com
Tue Sep 14 12:48:00 UTC 2021


On Tuesday, 14 September 2021 at 12:13:15 UTC, Steven 
Schveighoffer wrote:
> On 9/14/21 7:31 AM, eugene wrote:
>> On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
>>              EventSource s = events[k].es;
>>              ulong ecode = s.eventCode(events[k].event_mask); 
>> // <<<<< SIGSEGV
> Note that s likely still points at a valid memory address.

yeah, this address is obtained from OS (epoll_event struct),
compiler can not zero it.

> However, when an object is destroyed, its vtable is nulled out 
> (precisely to cause a segfault if you try to use an 
> already-freed object).

that's right - calling eventCode() method results in segfault.



More information about the Digitalmars-d-learn mailing list