Adventure Game Studio

AGS Development => Editor Development => Topic started by: Crimson Wizard on Mon 23/09/2013 13:40:57

Title: Assertions in Scintilla engine
Post by: Crimson Wizard on Mon 23/09/2013 13:40:57
On some occasions, when running Editor in debug mode, I am being notified about assertions in Scintilla component.
This usually occurs when I open a script, select several lines, and hit Delete key.

For example:
Quote
Assertion [line < pdoc->LinesTotal()] failed at ..\scintilla\src\Editor.cxx 1932
Quote
Assertion [useCount == 0] failed at ..\scintilla\src\Editor.cxx 217

The raised assertion causes program to abort, which is pretty annoying; this does not happen in release version though.

Strange thing is that sometimes I can reproduce this over and over by quiting without save, reloading the project and repeating the action.
Then, at some point it stops reproducing...
Any thoughts anyone?
Title: Re: Assertions in Scintilla engine
Post by: tzachs on Mon 23/09/2013 21:12:17
Never happened to me, and I always run in debug.
Does it throw an exception? Maybe you have an exception enabled which you can disable (in the exceptions window). That's all I got...
Title: Re: Assertions in Scintilla engine
Post by: Crimson Wizard on Sun 27/10/2013 01:44:51
Still happening. On one occasion this happened when I was replacing (pasting over) all text in script by clipboard contents (so that it had to first delete all contents, I guess)

This is not an exception, but an internal Scintilla's "assertion".
The stack trace:
Spoiler

Quote
>   AGS.Native.dll!Platform::Assert(char* c = 0x10133EB4, char* file = 0x10133E98, int line = 1932) Line 2131   C++
   AGS.Native.dll!Editor::LayoutLine(int line = 1, Surface* surface = 0x0731C3A8, ViewStyle& vstyle = {...}, LineLayout* ll = 0x0732CC68, int width = 134217727) Line 1933   C++
   AGS.Native.dll!Editor::Paint(Surface* surfaceWindow = 0x0732C2A8, PRectangle rcArea = {...}) Line 2899   C++
   AGS.Native.dll!ScintillaWin::WndPaint(unsigned int wParam = 0) Line 440   C++
   AGS.Native.dll!ScintillaWin::WndProc(unsigned int iMessage = 15, unsigned int wParam = 0, int lParam = 0) Line 553 + 0xf bytes   C++
   [External Code]   
   AGS.Native.dll!ScintillaWin::SWndProc(HWND__* hWnd = 0x002007B6, unsigned int iMessage = 15, unsigned int wParam = 0, int lParam = 0) Line 2379 + 0x27 bytes   C++
   [Frames below may be incorrect and/or missing, no symbols loaded for mscorwks.dll]   
   [External Code]   
   AGS.Controls.dll!Scintilla.ScintillaControl.WndProc(ref System.Windows.Forms.Message m = {msg=0xf (WM_PAINT) hwnd=0x2007b6 wparam=0x0 lparam=0x0 result=0x0}) Line 648 + 0xb bytes   C#
   [External Code]   
   user32.dll!766062fa()    
   user32.dll!76606d3a()    
   user32.dll!76606ce9()    
   user32.dll!76618336()    
   AGSEditor.exe!AGS.Editor.DockingContainer.Refresh() Line 31 + 0x8 bytes   C#
   AGSEditor.exe!AGS.Editor.TabbedDocumentManager.DocumentTitlesChanged() Line 108 + 0x40 bytes   C#
   AGSEditor.exe!AGS.Editor.frmMain.DocumentTitlesChanged() Line 257 + 0x10 bytes   C#
   AGSEditor.exe!AGS.Editor.GUIController.DocumentTitlesChanged() Line 449 + 0xd bytes   C#
   AGSEditor.exe!AGS.Editor.Components.BaseComponentWithScripts<AGS.Types.ScriptAndHeader,AGS.Types.ScriptFolder>.UpdateScriptWindowTitle(AGS.Editor.ScriptEditor editor = {AGS.Editor.ScriptEditor}) Line 79 + 0xd bytes   C#
   AGSEditor.exe!AGS.Editor.Components.BaseComponentWithScripts<AGS.Types.ScriptAndHeader,AGS.Types.ScriptFolder>.ScriptEditor_IsModifiedChanged(object sender = {AGS.Editor.ScriptEditor}, System.EventArgs e = null) Line 53 + 0xb bytes   C#
   AGSEditor.exe!AGS.Editor.ScriptEditor.scintilla_IsModifiedChanged(object sender = {Scintilla.ScintillaControl}, System.EventArgs e = null) Line 746 + 0x1d bytes   C#
   AGSEditor.exe!AGS.Editor.ScintillaWrapper.OnSavePointLeft(object sender = {Scintilla.ScintillaControl}, System.EventArgs e = null) Line 687 + 0x1d bytes   C#
   AGS.Controls.dll!Scintilla.ScintillaControl.DispatchScintillaEvent(Scintilla.SCNotification notification = {Scintilla.SCNotification}) Line 567 + 0x1f bytes   C#
   AGS.Controls.dll!Scintilla.ScintillaControl.WndProc(ref System.Windows.Forms.Message m = {msg=0x204e (WM_REFLECT + WM_NOTIFY) hwnd=0x2007b6 wparam=0x2007b6 lparam=0x6bc698 result=0x0}) Line 659 + 0x49 bytes   C#
   [External Code]   
   user32.dll!766062fa()    
   user32.dll!76606d3a()    
   user32.dll!76606ce9()    
   user32.dll!76606de8()    
   user32.dll!76606e44()    
   ntdll.dll!77b2010a()    
   user32.dll!766072b9()    
   user32.dll!7661216b()    
   user32.dll!766062fa()    
   user32.dll!76606d3a()    
   user32.dll!76606ce9()    
   user32.dll!76606de8()    
   AGS.Native.dll!SendMessage(HWND__* hWnd = 0x00140644, unsigned int Msg = 78, unsigned int wParam = 2099126, int lParam = 7063192) Line 3251 + 0x11 bytes   C++
   AGS.Native.dll!ScintillaWin::NotifyParent(SCNotification scn = {...}) Line 1163 + 0x4d bytes   C++
   [External Code]   
   AGS.Native.dll!Editor::NotifySavePoint(bool isSavePoint = false) Line 3612   C++
   AGS.Native.dll!Editor::NotifySavePoint(Document* document = 0x073264A8, void* userData = <undefined value>, bool atSavePoint = false) Line 3719   C++
   [External Code]   
   AGS.Native.dll!Document::NotifySavePoint(bool atSavePoint = false) Line 1406 + 0x57 bytes   C++
   AGS.Native.dll!Document::DeleteChars(int pos = 0, int len = 22) Line 386   C++
   AGS.Native.dll!Editor::ClearSelection() Line 3412 + 0x1a bytes   C++
   AGS.Native.dll!Editor::Clear() Line 3513   C++
   AGS.Native.dll!Editor::WndProc(unsigned int iMessage = 2180, unsigned int wParam = 0, int lParam = 0) Line 5760   C++
   AGS.Native.dll!ScintillaBase::WndProc(unsigned int iMessage = 2180, unsigned int wParam = 0, int lParam = 0) Line 724 + 0x12 bytes   C++
   AGS.Native.dll!ScintillaWin::WndProc(unsigned int iMessage = 2180, unsigned int wParam = 0, int lParam = 0) Line 954 + 0x18 bytes   C++
   [External Code]   
   AGS.Native.dll!Editor::KeyDown(int key = 308, bool shift = false, bool ctrl = false, bool alt = false, bool* consumed = 0x07320368) Line 4620 + 0x25 bytes   C++
   AGS.Native.dll!ScintillaWin::WndProc(unsigned int iMessage = 256, unsigned int wParam = 46, int lParam = 22216705) Line 751 + 0x7b bytes   C++
   [External Code]   
   AGS.Native.dll!ScintillaWin::SWndProc(HWND__* hWnd = 0x002007B6, unsigned int iMessage = 256, unsigned int wParam = 46, int lParam = 22216705) Line 2379 + 0x27 bytes   C++
   [External Code]   
   AGS.Controls.dll!Scintilla.ScintillaControl.WndProc(ref System.Windows.Forms.Message m = {msg=0x100 (WM_KEYDOWN) hwnd=0x2007b6 wparam=0x2e lparam=0x1530001 result=0x0}) Line 648 + 0xb bytes   C#
   [External Code]   
   AGSEditor.exe!AGS.Editor.GUIController.StartGUI(string[] commandLineArguments = {string[0]}) Line 1403 + 0xb bytes   C#
   AGSEditor.exe!AGS.Editor.ApplicationController.StartGUI(string[] commandLineArguments = {string[0]}) Line 123 + 0x10 bytes   C#
   AGSEditor.exe!AGS.Editor.Program.RunApplication(string[] args = {string[0]}) Line 55 + 0x10 bytes   C#
   AGSEditor.exe!AGS.Editor.Program.Main(string[] args = {string[0]}) Line 23 + 0x8 bytes   C#

[close]

The assertion that fails in Editor::LayoutLine (Editor.cxx):
Code (cpp) Select

PLATFORM_ASSERT(line < pdoc->LinesTotal());

line = 1,
pdoc->LinesTotal() returns 1

I suspect there's a mistake in logic somewhere.
Title: Re: Assertions in Scintilla engine
Post by: Crimson Wizard on Tue 02/08/2016 16:24:28
*Bump*
Bumping this just in case someone wants to take a look and find out how to fix this, because it annoys the hell out of me when I am debugging the Editor.
Title: Re: Assertions in Scintilla engine
Post by: Gurok on Wed 03/08/2016 01:42:38
This happens all the time to me and bugs me a lot too. I didn't know it was caused by an assertion.