https://bugs.winehq.org/show_bug.cgi?id=58054
Bug ID: 58054 Summary: concurrent modifications of C++ collection during iteration Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: christophgil@gmail.com Distribution: ---
Deleting elements from a C++ collection during iteration is not allowed.
This is a frequent programming error which goes unnoticed.
It is not reported as a runtime error and tolerated on native Windows, while it causes page faults in Wine.
This bug in Windows executables may be reason why programs fail on Wine.
Suggestion: Please report this as a runtime error and/or make the runtime lib tolerant.
https://bugs.winehq.org/show_bug.cgi?id=58054
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- What is this about exactly? Do you have a test project that shows this problem?
https://bugs.winehq.org/show_bug.cgi?id=58054
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal
https://bugs.winehq.org/show_bug.cgi?id=58054
--- Comment #2 from Christoph christophgil@gmail.com --- Thank you for getting in touch.
I wanted to share some insights regarding the program diann.exe (https://github.com/vdemichev/DiaNN), which previously crashed with a page fault immediately after startup when run under Wine.
At that time, the author kindly granted us access to the source code (which we unfortunately no longer have). Through basic printf debugging, we identified the issue as a std::vector being modified (elements deleted) while being iterated over—a classic case of unsafe concurrent modification.
Once this bug was resolved, DIA-NN ran stably under Wine and was even successfully ported to Linux natively.
Although I’m not a C++ programmer, I do have experience in Java, where such an error would typically result in a runtime exception. The fact that the VC++ environment did not catch this might suggest that this type of issue is a common programming pitfall, potentially contributing to the instability of Windows executables under Wine.
At the time, I was not yet well-versed in Wine internals. Today, I would consider replacing certain DLLs with their native Windows counterparts as a possible workaround.
Suggestions:
1. Quick & Low-Effort Improvement: Implementing modification counters in containers (e.g., vectors, lists) could help detect unsafe changes during iteration. These counters could increment on insertions or deletions, triggering a warning to /dev/stderr if a concurrent modification is detected. This could be accompanied by guidance on resolving the issue, possibly using winetricks or other tools.
2. Longer-Term Enhancement: Making standard containers more tolerant to concurrent modifications would require significantly more effort, but could increase robustness for a broader range of applications.
Please let me know if any of this is helpful or if you'd like me to elaborate further.
https://bugs.winehq.org/show_bug.cgi?id=58054
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- Let me ask again. Do you have an application that shows some issue when running with Wine or not? I don't believe standard c++ library core exists in shared modules.
http://bugs.winehq.org/show_bug.cgi?id=58054
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |ABANDONED Status|UNCONFIRMED |RESOLVED CC| |z.figura12@gmail.com
--- Comment #4 from Zeb Figura z.figura12@gmail.com --- No response, resolving ABANDONED.