In a debug build: 1. Create any macro, e.g., empty one like this: sub OnSelectionChange end sub and put a breakpoint in it (e.g., to the "end sub" line). 2. In a new Calc document, assign this macro to the sheet's "Selection changed" event. 3. Click on any different cell and start typing. Note that nothing gets typed in the cell. 4. Return to Basic IDE, and see that the macro has the breakpoint triggered; resume execution (may be a couple of times) => crash because of failed assertion at https://opengrok.libreoffice.org/xref/core/editeng/source/editeng/impedit2.cxx?r=673a210b&mo=118052&fi=3119#3121 This line became an assert in commit https://git.libreoffice.org/core/+/e1972743d692c8d8611912c31aae2cb08ae7636d Noel: could you take a look at this, if something wrong happens here in these circumstances?
Created attachment 179170 [details] Screencast With https://gerrit.libreoffice.org/c/core/+/132209/1, it still fails - exactly at the same place.
Created attachment 179182 [details] Calls to ImpEditEngine::SetUpdateLayout With https://gerrit.libreoffice.org/c/core/+/132209/4 : I traced calls to ImpEditEngine::SetUpdateLayout, and here is the result up to the assert. The last line in the attachment is 'this' as seen in ImpEditEngine::PaMtoEditCursor; and the previous occurrence of the same 'this' value called SetUpdateLayout with 'false' argument in response to the Basic's breakpoint. Noel: I hope this could help you to see what is missing (where to put the missing call to SetUpdateLayout(true))?
Just in case: this is the call stack at the assert. > ucrtbased.dll!issue_debug_notification(const wchar_t * const message) Line 28 > at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(28) > ucrtbased.dll!__acrt_report_runtime_error(const wchar_t * message) Line 154 > at minkernel\crts\ucrt\src\appcrt\internal\report_runtime_error.cpp(154) > ucrtbased.dll!abort() Line 61 > at minkernel\crts\ucrt\src\appcrt\startup\abort.cpp(61) > ucrtbased.dll!common_assert_to_stderr<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number) Line 187 > at minkernel\crts\ucrt\src\appcrt\startup\assert.cpp(187) > ucrtbased.dll!common_assert<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 420 > at minkernel\crts\ucrt\src\appcrt\startup\assert.cpp(420) > ucrtbased.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444 > at minkernel\crts\ucrt\src\appcrt\startup\assert.cpp(444) > editenglo.dll!ImpEditEngine::PaMtoEditCursor(EditPaM aPaM, GetCursorFlags nFlags) Line 3121 > at C:\lo\src\core\editeng\source\editeng\impedit2.cxx(3121) > editenglo.dll!ImpEditEngine::DoOnlineSpelling(ContentNode * pThisNodeOnly, bool bSpellAtCursorPos, bool bInterruptible) Line 2329 > at C:\lo\src\core\editeng\source\editeng\impedit4.cxx(2329) > editenglo.dll!EditEngine::CompleteOnlineSpelling() Line 2395 > at C:\lo\src\core\editeng\source\editeng\editeng.cxx(2395) > sclo.dll!ScInputHandler::EnterHandler(ScEnterMode nBlockMode) Line 3098 > at C:\lo\src\core\sc\source\ui\app\inputhdl.cxx(3098) > sclo.dll!ScModule::InputEnterHandler(ScEnterMode nBlockMode) Line 1416 > at C:\lo\src\core\sc\source\ui\app\scmod.cxx(1416) > sclo.dll!ScTabView::UpdateInputLine() Line 3034 > at C:\lo\src\core\sc\source\ui\view\tabview3.cxx(3034) > sclo.dll!ScTabView::SetCursor(short nPosX, long nPosY, bool bNew) Line 386 > at C:\lo\src\core\sc\source\ui\view\tabview3.cxx(386) > sclo.dll!ScViewFunctionSet::SetCursorAtCell(short nPosX, long nPosY, bool bScroll) Line 726 > at C:\lo\src\core\sc\source\ui\view\select.cxx(726) > sclo.dll!ScViewFunctionSet::SetCursorAtPoint(const Point & rPointPixel, bool __formal) Line 421 > at C:\lo\src\core\sc\source\ui\view\select.cxx(421) > vcllo.dll!SelectionEngine::SelMouseButtonDown(const MouseEvent & rMEvt) Line 174 > at C:\lo\src\core\vcl\source\window\seleng.cxx(174) > sclo.dll!ScTabView::SelMouseButtonDown(const MouseEvent & rMEvt) Line 1178 > at C:\lo\src\core\sc\source\ui\view\tabview3.cxx(1178) > sclo.dll!ScGridWindow::HandleMouseButtonDown(const MouseEvent & rMEvt, ScGridWindow::MouseEventState & rState) Line 2144 > at C:\lo\src\core\sc\source\ui\view\gridwin.cxx(2144) > sclo.dll!ScGridWindow::MouseButtonDown(const MouseEvent & rMEvt) Line 1711 > at C:\lo\src\core\sc\source\ui\view\gridwin.cxx(1711) > vcllo.dll!ImplHandleMouseEvent(const VclPtr<vcl::Window> & xWindow, MouseNotifyEvent nSVEvent, bool bMouseLeave, __int64 nX, __int64 nY, unsigned __int64 nMsgTime, unsigned short nCode, MouseEventModifiers nMode) Line 710 > at C:\lo\src\core\vcl\source\window\winproc.cxx(710) > vcllo.dll!ImplHandleSalMouseButtonDown(vcl::Window * pWindow, const SalMouseEvent * pEvent) Line 2285 > at C:\lo\src\core\vcl\source\window\winproc.cxx(2285) > vcllo.dll!ImplWindowFrameProc(vcl::Window * _pWindow, SalEvent nEvent, const void * pEvent) Line 2636 > at C:\lo\src\core\vcl\source\window\winproc.cxx(2636) > vcllo.dll!SalFrame::CallCallback(SalEvent nEvent, const void * pEvent) Line 308 > at C:\lo\src\core\vcl\inc\salframe.hxx(308) > vclplug_winlo.dll!ImplHandleMouseMsg(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 3235 > at C:\lo\src\core\vcl\win\window\salframe.cxx(3235) > vclplug_winlo.dll!SalFrameWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam, bool & rDef) Line 5612 > at C:\lo\src\core\vcl\win\window\salframe.cxx(5612) > vclplug_winlo.dll!SalFrameWndProcW(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 5965 > at C:\lo\src\core\vcl\win\window\salframe.cxx(5965) > user32.dll!UserCallWinProcCheckWow() > user32.dll!DispatchMessageWorker() > vclplug_winlo.dll!ImplSalDispatchMessage(const tagMSG * pMsg) Line 475 > at C:\lo\src\core\vcl\win\app\salinst.cxx(475) > vclplug_winlo.dll!ImplSalYield(bool bWait, bool bHandleAllCurrentEvents) Line 506 > at C:\lo\src\core\vcl\win\app\salinst.cxx(506) > vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) Line 581 > at C:\lo\src\core\vcl\win\app\salinst.cxx(581) > vcllo.dll!ImplYield(bool i_bWait, bool i_bAllEvents) Line 474 > at C:\lo\src\core\vcl\source\app\svapp.cxx(474) > vcllo.dll!Application::Yield() Line 559 > at C:\lo\src\core\vcl\source\app\svapp.cxx(559) > vcllo.dll!Application::Execute() Line 452 > at C:\lo\src\core\vcl\source\app\svapp.cxx(452) > sofficeapp.dll!desktop::Desktop::Main() Line 1600 > at C:\lo\src\core\desktop\source\app\app.cxx(1600) > vcllo.dll!ImplSVMain() Line 202 > at C:\lo\src\core\vcl\source\app\svmain.cxx(202) > vcllo.dll!SVMain() Line 235 > at C:\lo\src\core\vcl\source\app\svmain.cxx(235) > sofficeapp.dll!soffice_main() Line 94 > at C:\lo\src\core\desktop\source\app\sofficemain.cxx(94) > soffice.bin!sal_main() Line 51 > at C:\lo\src\core\desktop\source\app\main.c(51) > soffice.bin!main(int argc, char * * argv) Line 49 > at C:\lo\src\core\desktop\source\app\main.c(49) > soffice.bin!invoke_main() Line 79 > at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(79) > soffice.bin!__scrt_common_main_seh() Line 288 > at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(288) > soffice.bin!__scrt_common_main() Line 331 > at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(331) > soffice.bin!mainCRTStartup(void * __formal) Line 17 > at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp(17) > kernel32.dll!BaseThreadInitThunk() > ntdll.dll!RtlUserThreadStart()
Confirmed using LO 7.4.0.0.alpha0+ (1bf5884a7bd5e506c6edd9769f98e3102a4c4eb9) / Ubuntu.
Noel Grandin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7ac26ea039ea0c355b80232e30c29a07e2bb027d tdf#148087 assert editing a cell with OnSelectionChange macro breakpoint It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.