Prevent file corruption in some cases#120
Conversation
The session snapshot feature runs in its own thread and access to Scintilla etc is not thread-safe. As a *temporary* and *non-exhaustive* fix we guard some long-running operations (undo, redo, replace, sort) with a mutex to prevent data corruption.
|
This is a desperately needed fix to a serious issue. You're awesome |
|
Three questions:
|
|
Xref: Issue #24 |
|
snickers quietly (2) is definitely my C background speaking..... but using a
|
I know. What I mean is that I only want structs as dumb groupings of variables. Anything else gets to be a class. It's akin to Hungarian notation or prefixing member variables with "m_". |
Fair enough. As long as you're not using it instead of |
See Sourceforge #5327.
Seconded! Awesomeness +2 |
[BUG_FIXED] Prevent big file corruption on some long period operations.
|
Nice patch! |
|
New version 6.7.9 with this patch have problems.
|
|
@DmFedorov The patch was pulled out of 6.7.9 due to compatibility issues with WinXP, so it can't very well be the cause of those problems! (It will be in the next version.) Number one is due to #116, don't know about the other one. Maybe start a new issue? |
|
OK. I checked the new version. Yes, the patch is not used. |
update to https://www.scintilla.org/scintilla533.zip with: Released 8 February 2023. Fix SCI_LINESJOIN bug where carriage returns were incorrectly retained. Bug notepad-plus-plus#2372. Fix SCI_VERTICALCENTRECARET to update the vertical scroll position. When an autocompletion list is shown in response to SCN_CHARADDED, do not process character as fill-up or stop. This avoids closing immediately when a character may both trigger and finish autocompletion. On Cocoa fix character input bug where dotless 'i' and some other extended Latin characters could not be entered. The change also stops SCI_ASSIGNCMDKEY from working with these characters on Cocoa. Bug notepad-plus-plus#2374. On GTK, support IME context. Feature notepad-plus-plus#1476. On GTK on Win32, fix scrolling speed to not be too fast. Bug notepad-plus-plus#2375. On Qt, fix indicator drawing past left of text pane over margin. Bug notepad-plus-plus#2373, Bug notepad-plus-plus#1956. On Qt, allow scrolling with mouse wheel when scroll bar hidden. and https://www.scintilla.org/lexilla522.zip with Released 8 February 2023. C++: Fix keywords that start with non-ASCII. Also affects other lexers. Issue notepad-plus-plus#130. Matlab: Include more prefix and suffix characters in numeric literals. Issue notepad-plus-plus#120. Matlab: More accurate treatment of line ends inside strings. Matlab and Octave are different here. Issue notepad-plus-plus#18. Modula-3: Don't treat identifier suffix that matches keyword as keyword. Issue notepad-plus-plus#129. Modula-3: Fix endless loop in folder. Issue notepad-plus-plus#128. Modula-3: Fix access to lines beyond document end in folder. Issue notepad-plus-plus#131. Python: Don't highlight match and case as keywords in contexts where they probably aren't used as keywords. Pull request notepad-plus-plus#122. X12: Support empty envelopes. Bug notepad-plus-plus#2369.
update to https://www.scintilla.org/scintilla533.zip with: Released 8 February 2023. Fix SCI_LINESJOIN bug where carriage returns were incorrectly retained. Bug notepad-plus-plus#2372. Fix SCI_VERTICALCENTRECARET to update the vertical scroll position. When an autocompletion list is shown in response to SCN_CHARADDED, do not process character as fill-up or stop. This avoids closing immediately when a character may both trigger and finish autocompletion. On Cocoa fix character input bug where dotless 'i' and some other extended Latin characters could not be entered. The change also stops SCI_ASSIGNCMDKEY from working with these characters on Cocoa. Bug notepad-plus-plus#2374. On GTK, support IME context. Feature notepad-plus-plus#1476. On GTK on Win32, fix scrolling speed to not be too fast. Bug notepad-plus-plus#2375. On Qt, fix indicator drawing past left of text pane over margin. Bug notepad-plus-plus#2373, Bug notepad-plus-plus#1956. On Qt, allow scrolling with mouse wheel when scroll bar hidden. and https://www.scintilla.org/lexilla522.zip with Released 8 February 2023. C++: Fix keywords that start with non-ASCII. Also affects other lexers. Issue notepad-plus-plus#130. Matlab: Include more prefix and suffix characters in numeric literals. Issue notepad-plus-plus#120. Matlab: More accurate treatment of line ends inside strings. Matlab and Octave are different here. Issue notepad-plus-plus#18. Modula-3: Don't treat identifier suffix that matches keyword as keyword. Issue notepad-plus-plus#129. Modula-3: Fix endless loop in folder. Issue notepad-plus-plus#128. Modula-3: Fix access to lines beyond document end in folder. Issue notepad-plus-plus#131. Python: Don't highlight match and case as keywords in contexts where they probably aren't used as keywords. Pull request notepad-plus-plus#122. X12: Support empty envelopes. Bug notepad-plus-plus#2369. update CMakeLists.txt to latest changes within vcxproj file
update to https://www.scintilla.org/scintilla533.zip with: Released 8 February 2023. Fix SCI_LINESJOIN bug where carriage returns were incorrectly retained. Bug notepad-plus-plus#2372. Fix SCI_VERTICALCENTRECARET to update the vertical scroll position. When an autocompletion list is shown in response to SCN_CHARADDED, do not process character as fill-up or stop. This avoids closing immediately when a character may both trigger and finish autocompletion. On Cocoa fix character input bug where dotless 'i' and some other extended Latin characters could not be entered. The change also stops SCI_ASSIGNCMDKEY from working with these characters on Cocoa. Bug notepad-plus-plus#2374. On GTK, support IME context. Feature notepad-plus-plus#1476. On GTK on Win32, fix scrolling speed to not be too fast. Bug notepad-plus-plus#2375. On Qt, fix indicator drawing past left of text pane over margin. Bug notepad-plus-plus#2373, Bug notepad-plus-plus#1956. On Qt, allow scrolling with mouse wheel when scroll bar hidden. and https://www.scintilla.org/lexilla522.zip with Released 8 February 2023. C++: Fix keywords that start with non-ASCII. Also affects other lexers. Issue notepad-plus-plus#130. Matlab: Include more prefix and suffix characters in numeric literals. Issue notepad-plus-plus#120. Matlab: More accurate treatment of line ends inside strings. Matlab and Octave are different here. Issue notepad-plus-plus#18. Modula-3: Don't treat identifier suffix that matches keyword as keyword. Issue notepad-plus-plus#129. Modula-3: Fix endless loop in folder. Issue notepad-plus-plus#128. Modula-3: Fix access to lines beyond document end in folder. Issue notepad-plus-plus#131. Python: Don't highlight match and case as keywords in contexts where they probably aren't used as keywords. Pull request notepad-plus-plus#122. X12: Support empty envelopes. Bug notepad-plus-plus#2369. update CMakeLists.txt to latest changes within vcxproj file
update to https://www.scintilla.org/scintilla533.zip with: Released 8 February 2023. Fix SCI_LINESJOIN bug where carriage returns were incorrectly retained. Bug notepad-plus-plus#2372. Fix SCI_VERTICALCENTRECARET to update the vertical scroll position. When an autocompletion list is shown in response to SCN_CHARADDED, do not process character as fill-up or stop. This avoids closing immediately when a character may both trigger and finish autocompletion. On Cocoa fix character input bug where dotless 'i' and some other extended Latin characters could not be entered. The change also stops SCI_ASSIGNCMDKEY from working with these characters on Cocoa. Bug notepad-plus-plus#2374. On GTK, support IME context. Feature notepad-plus-plus#1476. On GTK on Win32, fix scrolling speed to not be too fast. Bug notepad-plus-plus#2375. On Qt, fix indicator drawing past left of text pane over margin. Bug notepad-plus-plus#2373, Bug notepad-plus-plus#1956. On Qt, allow scrolling with mouse wheel when scroll bar hidden. and https://www.scintilla.org/lexilla522.zip with Released 8 February 2023. C++: Fix keywords that start with non-ASCII. Also affects other lexers. Issue notepad-plus-plus#130. Matlab: Include more prefix and suffix characters in numeric literals. Issue notepad-plus-plus#120. Matlab: More accurate treatment of line ends inside strings. Matlab and Octave are different here. Issue notepad-plus-plus#18. Modula-3: Don't treat identifier suffix that matches keyword as keyword. Issue notepad-plus-plus#129. Modula-3: Fix endless loop in folder. Issue notepad-plus-plus#128. Modula-3: Fix access to lines beyond document end in folder. Issue notepad-plus-plus#131. Python: Don't highlight match and case as keywords in contexts where they probably aren't used as keywords. Pull request notepad-plus-plus#122. X12: Support empty envelopes. Bug notepad-plus-plus#2369. update CMakeLists.txt to latest changes within vcxproj file
update to https://www.scintilla.org/scintilla533.zip with: 1. Released 8 February 2023. 2. Fix SCI_LINESJOIN bug where carriage returns were incorrectly retained. Bug #2372. 3. Fix SCI_VERTICALCENTRECARET to update the vertical scroll position. 4. When an autocompletion list is shown in response to SCN_CHARADDED, do not process character as fill-up or stop. This avoids closing immediately when a character may both trigger and finish autocompletion. 5. On Cocoa fix character input bug where dotless 'i' and some other extended Latin characters could not be entered. The change also stops SCI_ASSIGNCMDKEY from working with these characters on Cocoa. Bug #2374. 6. On GTK, support IME context. Feature #1476. 7. On GTK on Win32, fix scrolling speed to not be too fast. Bug #2375. 8. On Qt, fix indicator drawing past left of text pane over margin. Bug #2373, Bug #1956. 9. On Qt, allow scrolling with mouse wheel when scroll bar hidden. and https://www.scintilla.org/lexilla522.zip with 1. Released 8 February 2023. 2. C++: Fix keywords that start with non-ASCII. Also affects other lexers. Issue #130. 3. Matlab: Include more prefix and suffix characters in numeric literals. Issue #120. 4. Matlab: More accurate treatment of line ends inside strings. Matlab and Octave are different here. Issue #18. 5. Modula-3: Don't treat identifier suffix that matches keyword as keyword. Issue #129. 6. Modula-3: Fix endless loop in folder. Issue #128. 7. Modula-3: Fix access to lines beyond document end in folder. Issue #131. 8. Python: Don't highlight match and case as keywords in contexts where they probably aren't used as keywords. Pull request #122. 9. X12: Support empty envelopes. Bug #2369. update CMakeLists.txt to latest changes within vcxproj file Close #13082
FileManager::backupCurrentBuffer() guards against being called at the same time from different threads, but it does nothing to prevent non-threadsafe access to Scintilla etc.
In an ideal world, this feature would be turned off until it can be implemented safely (it looks like a lot of work to me, but maybe someone can think of an easy solution). I don't think that's going to happen, so as a temporary fix I've added a mutex which will prevent corruption in some cases (undo, redo, replace, sort).