Understanding SIGSEGV issues

Russel Winder russel at winder.org.uk
Sat Jan 5 11:33:50 UTC 2019

On Sat, 2019-01-05 at 10:52 +0000, Russel Winder wrote:
> On Sat, 2019-01-05 at 10:31 +0000, Nicholas Wilson via Digitalmars-d-learn
> wrote:
> […]
> > Maybe it is a problem with copying a File_Ptr (e.g. missing a 
> > increase of the reference count)? Like, `auto a = File_Ptr(); { 
> > auto b = a; }` and b calls the destructor on scope exit.
> > That would be consistent with having problems copying to object 
> > to pass to writeln.
> I found the problem and then two minutes later read your email and bingo we
> have found the problem.
> Previously I had used File_Ptr* and on this occasion I was using File_Ptr
> and
> there was no copy constructor because I have @disable this(this). Except
> that
> clearly copying a value is not copying a value in this case. Clearly this
> situation is what is causing the destructor to be called on an unconstructed
> value. But I have no idea why.
> The question now, of course, is should I have been using File_Ptr instead of
> File_Ptr* in the first place. I am beginning to think I should have been.
> More
> thinking needed.

Switching to using File_Ptr* I now get the SIGSEGV at the end of main as you
were thinking before. Oh f###.

This code used to work. :-(

Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20190105/f507ee88/attachment.sig>

More information about the Digitalmars-d-learn mailing list