0
votes

I'm trying to use the TWICImage class in C++builder to save an in-memory bitmap to TIFF file. However, any attempt to use the Assign() method on TWICImage gives an access error.

For example:

TBitmap* bmp = new TBitmap();
TWICImage* wic = new TWICImage();
wic->Assign( bmp );

gives the access violation on the third line.

1
I cannot reproduce the issue. Could you give more details? - manlio
Hmmm. It crashes at the point in my code where I tried it, but not in a fresh project. I'll take a look at project options. - Nigel Hawkins

1 Answers

0
votes

After a bit more digging, the following gives an error on the second and subsequent assignments:

TBitmap* bmp = new TBitmap();
for (int i=0; i<10; ++i) {
    std::unique_ptr<TWICImage> wic( new TWICImage() );
    wic->Assign( bmp );
}

However, if I make the TWICImage pointer static, it all works as expected. So it looks like there is something odd going on in the TWICImage destructor.