1

then最初の句が終了すると、その時点で範囲外になるため破棄されると想定しても安全ですかbitmapStream(それにより、ref カウントが 0 になります)。

BitmapImage^ bmp = ref new BitmapImage();
create_task(StorageFile::GetFileFromApplicationUriAsync(uri)).then([](StorageFile^ file)
{
    return file->OpenReadAsync();
}).then([bmp](IRandomAccessStream^ bitmapStream)
{
    return bmp->SetSourceAsync(bitmapStream);
}).then([bmp]()
{
    // Do some stuff with bmp here
});
4

1 に答える 1