Odd Destructor Behavior

Matt Elkins via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 7 14:49:35 PST 2016


On Sunday, 7 February 2016 at 22:04:27 UTC, anonymous wrote:
> On 07.02.2016 22:49, Matt Elkins wrote:
>>  From this non-reduced situation, does anything jump out? Am I 
>> missing
>> something about struct lifetimes? This is the only place I 
>> instantiate a
>> TileView.
>
> Looks weird. I presume this doesn't happen with simpler 
> constructor parameters/arguments, like int instead of 
> Texture.Handle? I don't see how the parameter types would make 
> a destructor call appear. Might be a bug.

Correct; if I switch the second Texture.Handle to an int it 
doesn't happen. Nor if I remove it altogether. Nor if I create 
the Texture.Handle on the line immediately above TileView's 
construction, and then pass in the created Texture.Handle. I also 
didn't understand how the parameters would cause this.

> Can you post the code for Texture, makeInputStream, etc, so 
> that we have a full, reproducible test case?

Oi. Yes, I can, but it is quite a lot of code even if you don't 
count that it is dependent on OpenGL, GLFW, and gl3n to run to 
this point. This is why I was disappointed that simpler 
reproducing cases weren't appearing. I should probably spend more 
time trying to reduce the case some...


More information about the Digitalmars-d-learn mailing list