[pywin32-bugs] [ pywin32-Bugs-2918564 ] DuplicateHandle to different process
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2009-12-21 10:12:52
|
Bugs item #2918564, was opened at 2009-12-21 10:12 Message generated for change (Tracker Item Submitted) made by rockthesmurf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2918564&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: pythonwin Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Steven Craft (rockthesmurf) Assigned to: Nobody/Anonymous (nobody) Summary: DuplicateHandle to different process Initial Comment: I am not sure if this is necessarily a bug - it feels like it to me, but either way it would be helpful if the documentation at least mentioned it. If you call win32api.DuplicateHandle and specify the target process NOT to be the current process, the handle you get back will be ref counted etc. and when it goes out of scope CloseHandle will be called on it, but of course the handle in question is not owned by the current process, so causing CloseHandle on it is not the right thing to do, doing this will cause problems much later on (in my case, it doesn't complain when the handle is closed, but at some point later, when I call win32pipe.CreatePipe I get a bad handle back (and it has the same number as the handle that was incorrectly closed previously). The manual fix for this is easy, I just need to call Detach( ) on any handles that I duplicate in to other processes, but it took me a while to track this down etc. which is why I though it is worth logging a bug, so if nothing else it could be documented to save others having similar problems! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2918564&group_id=78018 |