Here is fantasy code demonstrating the problem I\'m trying to solve (see the comment // PROBLEM -); basically, how to make sure to detach a bunch of resource handle
// PROBLEM -