This is the mail archive of the firstname.lastname@example.org
mailing list for the Cygwin project. See the Cygwin
home page for more information.
(patch) reg_key copy construction bug
- To: email@example.com
- Subject: (patch) reg_key copy construction bug
- From: Mumit Khan <firstname.lastname@example.org.EDU>
- Date: Thu, 29 Apr 1999 15:08:36 -0500
The following fix is hopefully obvious. Think of what happens when you
pass a copy of a (open) reg_key to a function -- it calls the destructor
on the way back, and so the does the original and RegClose crashes trying.
The current implementation of reg_key is dangerous in that it blindly
allows a copy construction; it should really disable copying by using
a private copy. However that'll break the subkey generation, so it'll
take a bit of rework.
The current code should always crash in mount_info::from_registry ()
when Cygwin1.dll starts up.
Thu Apr 29 13:55:57 1999 Mumit Khan <email@example.com>
* shared.h (read_mounts): Change prototype to accept a reference
to reg_key, not a copy.
* path.cc (read_mounts): Likewise.
--- shared.h.~1 Thu Apr 29 13:51:51 1999
+++ shared.h Thu Apr 29 13:52:13 1999
@@ -335,7 +335,7 @@ public:
void sort ();
- void read_mounts (reg_key r);
+ void read_mounts (reg_key& r);
void read_v1_mounts (reg_key r, const int which);
void mount_slash ();
void to_registry ();
--- path.cc.~1 Thu Apr 29 13:55:20 1999
+++ path.cc Thu Apr 29 13:52:19 1999
@@ -1158,7 +1158,7 @@ mount_info::binary_win32_path_p (const c
-mount_info::read_mounts (reg_key r)
+mount_info::read_mounts (reg_key& r)
HKEY key = r.get_key ();