notepad-plus-plus/PowerEditor
Don Ho bbeaafac8b Fix period backup crash due to the dead lock of std::lock_guard
The crash occurs because the thread terminates the task prematurely due to PostMessage’s nature. As a result, FileManager::backupCurrentBuffer() is always executed by the main thread, leading to a deadlock ( due to "std::lock_guard<std::mutex> lock(backup_mutex);") on the 2nd main thread’s entry and causing the crash. Here the explanation:
"If lock is called by a thread that already owns the mutex, the behavior is undefined: for example, the program may deadlock."
ref: https://en.cppreference.com/w/cpp/thread/mutex/lock

Using SendMessage instead of PostMessage ensures that the thread executes the task from the beginning to the end and keeps the mutex until the entire operation is terminated. Therefore, the race condition is prevented by the mutex lock while the 2nd thread tries to access the same code/zone.

Fix #14906, close #14917
2024-03-29 16:14:44 +01:00
..
Test Add more unit tests for Function List of Python 2024-02-07 22:30:55 +01:00
bin Notepad++ v8.6.4 release 2024-02-20 01:42:05 +01:00
gcc Revert "Improve hiDPI appearance for some DM elements" 2024-03-17 17:39:28 +01:00
installer [xml] Fix & update italian.xml 2024-03-24 11:21:53 +01:00
misc/chameleon Remove the old icon 2016-09-21 09:06:22 +02:00
scintilla.original.forUpdating Update to scintilla 5.4.3 (from 5.4.1) & Lexilla 5.3.1 2024-03-11 04:13:10 +01:00
src Fix period backup crash due to the dead lock of std::lock_guard 2024-03-29 16:14:44 +01:00
visual.net Revert "Improve hiDPI appearance for some DM elements" 2024-03-17 17:39:28 +01:00