Closed dmondrik closed 11 months ago
It looks good to me. Why does FindRsrc need to open the resource handle? Does ParseRsrc open the resource handle?
Why does it need to open the resource manager? Because the first parameter to viFindRsrc is the resource manager handle. This is one of 3 operations on a resource manager. The other 2 are Parse and Open, and yes they both do the same.
It looks good to me. Why does FindRsrc need to open the resource handle? Does ParseRsrc open the resource handle?
Why does it need to open the resource manager? Because the first parameter to viFindRsrc is the resource manager handle. This is one of 3 operations on a resource manager. The other 2 are Parse and Open, and yes they both do the same.
I see, so it is the resource manager handle. Does Parse method need to close the resource manager as well, similar as this change to the FindRsrc?
I see, so it is the resource manager handle. Does Parse method need to close the resource manager as well, similar as this change to the FindRsrc?
This PR does not close the resource manager handle. This is yet another handle, specific to the response from viFindRsrc. Consider 2 distinct calls with different expressions to viFindRsrc that return multiple resources each. The "find handle" is the only way to distinguish the results, used only for repeated calls to viFindNext, and must be closed separately.
I see, so it is the resource manager handle. Does Parse method need to close the resource manager as well, similar as this change to the FindRsrc?
This PR does not close the resource manager handle. This is yet another handle, specific to the response from viFindRsrc. Consider 2 distinct calls with different expressions to viFindRsrc that return multiple resources each. The "find handle" is the only way to distinguish the results, used only for repeated calls to viFindNext, and must be closed separately.
Extended question not related to this PR, but why does the find handle
need to be opened, and is not passed as a string instead? The resource name could be good to distinguish the resources, right?
What does this Pull Request accomplish?
Close the handle returned from
viFindRsrc
when we're done with it.Why should this Pull Request be merged?
This fixes a resource leak.
What testing has been done?
FindRsrc_OpensResourceManagerOnceAndClosesFindHandle