View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002686||Far Manager||Editor||public||2014-05-24 03:25||2014-06-04 21:13|
|Target Version||Fixed in Version||3.0|
|Summary||0002686: Debug build crashes in editor (fix included)|
I got stuck over two issues with debug build a month ago, while developing new plugin, and it looks unfixed up to Today's head on SVN (rev. 11833). Clean build and configuration, nothing additional installed.
Issues are not critical and not reproduced on release build, however, it's annoying on debug one and may be fixed in a minimal efforts.
1. Trying to compare uncomparable iterators on editor start, leads to assertion fairure on MSVC 2012 v.11.0.61030 Update 4 on Win 7 x64, Win32 debug build.
2. Attempt to decrement Line.begin() iterator: is performed on SHIFT-LEFT or SHIFT-CTRL-LEFT keys, cursor is located not at line start on a first line.
|Steps To Reproduce||1. Perform debug build. Tested on revisions up to |
2. Execute in console: echo "Hello world" > test.txt
3. Open "test.txt" in editor - it crashes with a message like
Debug Assertion Failed!
File: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\list
Expression: list iterators incompatible
When I managed to open editor on test.txt:
4. Press RIGHT key twice
5a. Press SHIFT-LEFT
5b. Press CTRL-SHIFT-LEFT
Both 3, 5a and 5b leads to crash.
|Additional Information||Bug cause and fix is trivial. Patch for revision 11833 is attached to this bug.|
A) Cause of issue when loading file into editor:
1. Editor::Editor() call => Editor::InsertString() - insert empty line and point
BlockStart, VBlockStart to that line.
2. FileEditor::LoadFile() call => Editor::FreeAllocatedData() => Lines.clear() - this invalidates old Line iterators, e.g. BlockStart, VBlockStart
3. Forgot to update BlockStart, VBlockStart
4. Editor::ShowEditor() => Editor::FastShow() => ... => Editor::EditorControl(ECTL_GETINFO, ...) - trying to compare invalidated iterators BlockStart, VBlockStart with Lines.end() leads to unexpected behaviour and assertion failure inside CRT.
B) [CTRL-]SHIIFT-LEFT: it's just undefined behaviour to call std::prev on list begin even when Editor's caret position by X-axis is not zero :)
Please review my patch and feel free to ask additional questions, if needed.
|Tags||No tags attached.|
|2014-05-24 03:25||4eyes||New Issue|
|2014-05-24 03:25||4eyes||File Added: unicode_far.r11833.patch|
|2014-05-24 11:04||DrKnS||Assigned To||=> DrKnS|
|2014-05-24 11:04||DrKnS||Status||new => assigned|
|2014-05-24 11:05||DrKnS||Note Added: 0012430|
|2014-05-24 11:05||DrKnS||Status||assigned => feedback|
|2014-06-04 21:13||DrKnS||Build||=> 3915|
|2014-06-04 21:13||DrKnS||Status||feedback => closed|
|2014-06-04 21:13||DrKnS||Resolution||open => fixed|
|2014-06-04 21:13||DrKnS||Fixed in Version||=> 3.0|