Commit 24703d8
Remove incorrect VirtualAllocEx usage
Before: Called VirtualAllocEx on the pointer from MapViewOfFile,
then unmapped both pointers.
After: Use only MapViewOfFile pointer directly.
Why this was wrong:
- VirtualAllocEx is for allocating memory in other processes,
not the current one
- MapViewOfFile already returns a committed, writable pointer
- Cleanup was using UnmapViewOfFile on both pointers,
but should use VirtualFreeEx for the VirtualAllocEx pointer
- This could cause subtle memory visibility issues on Windows
Changes in ShmWindows.java:
- Removed lines 118-128 (the VirtualAllocEx call and error handling)
- Removed writePointer from ShmInfo struct assignment
- Updated cleanup() to take only pointer and handle
(removed writePointer parameter)
Changes in ShmBase.java:
- Removed writePointer field from ShmInfo<HANDLE> class
- Removed writePointer from toString() method
Co-authored-by: Claude <[email protected]>1 parent 09a1406 commit 24703d8
File tree
2 files changed
+5
-18
lines changed- src/main/java/org/apposed/appose/shm
2 files changed
+5
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| |||
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
132 | | - | |
133 | | - | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
129 | 121 | | |
130 | 122 | | |
131 | 123 | | |
132 | 124 | | |
133 | 125 | | |
134 | 126 | | |
135 | | - | |
136 | 127 | | |
137 | 128 | | |
138 | 129 | | |
| |||
192 | 183 | | |
193 | 184 | | |
194 | 185 | | |
195 | | - | |
196 | | - | |
| 186 | + | |
197 | 187 | | |
198 | 188 | | |
199 | 189 | | |
| |||
0 commit comments