Understanding SIGSEGV issues
Nicholas Wilson
iamthewilsonator at hotmail.com
Sat Jan 5 11:30:22 UTC 2019
On Saturday, 5 January 2019 at 10:52:48 UTC, Russel Winder wrote:
> I found the problem and then two minutes later read your email
> and bingo we have found the problem.
Well done.
> 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.
Could you post a minimised example? Its a bit hard to guess
without one.
> 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.
From the name, File_Ptr sounds like it is wrapping a reference to
a resource. So compare with C's FILE/ D's File which is a
reference counted wrapper of a FILE*. Would you ever use a File*
(or a FILE**)? Probably not, I never have.
More information about the Digitalmars-d-learn
mailing list