Crash in LibreOffice.org

I am getting crash when LT is enabled
LT 6.0
Version: 7.4.5.1
Build ID: 40(Build:1)
CPU threads: 20; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US

com.sun.star.container.NoSuchElementException: at /builddir/build/BUILD/libreoffice-7.4.5.1/sw/source/core/unocore/unoobj2.cxx:655
at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method)
at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:185)
at jdk.proxy1/jdk.proxy1.$Proxy47.nextElement(Unknown Source)
at org.languagetool.openoffice.DocumentCursorTools.getDeletedCharacters(DocumentCursorTools.java:214)
at org.languagetool.openoffice.DocumentCursorTools.getAllTextParagraphs(DocumentCursorTools.java:303)
at org.languagetool.openoffice.DocumentCache.refreshWriterCache(DocumentCache.java:207)
at org.languagetool.openoffice.DocumentCache.refresh(DocumentCache.java:173)
at org.languagetool.openoffice.DocumentCache.refreshAndCompare(DocumentCache.java:1836)
at org.languagetool.openoffice.CheckRequestAnalysis.handleCacheChanges(CheckRequestAnalysis.java:767)
at org.languagetool.openoffice.CheckRequestAnalysis.changesInNumberOfParagraph(CheckRequestAnalysis.java:882)
at org.languagetool.openoffice.CheckRequestAnalysis.getParaFromFlatparagraph(CheckRequestAnalysis.java:552)
at org.languagetool.openoffice.CheckRequestAnalysis.getParaPos(CheckRequestAnalysis.java:503)
at org.languagetool.openoffice.CheckRequestAnalysis.getNumberOfParagraph(CheckRequestAnalysis.java:146)
at org.languagetool.openoffice.SingleDocument.getCheckResults(SingleDocument.java:301)
at org.languagetool.openoffice.SingleDocument.getCheckResults(SingleDocument.java:165)
at org.languagetool.openoffice.MultiDocumentsHandler.getCheckResults(MultiDocumentsHandler.java:231)
at org.languagetool.openoffice.MultiDocumentsHandler.doProofreading(MultiDocumentsHandler.java:174)
at org.languagetool.openoffice.Main.doProofreading(Main.java:81)

In what context happened the crash?

I had a file opened (big one - ~180 pages) and LT check enabled (Ukrainian language).
After I work editing the text and scrolling through the pages at some point LibreOffice crashes.
Usually happened every ~3-5 min, and roughly 5-10 pages scrolled.

Ok, a but more context: I had lots of sentences split by new line (new paragraph to be precise), so I had a lot of UpperCaseSentence rule errors. I was merging lots of sentences together, I wonder if that has something to do with it.
Also I had the option set to Text mode.
Once I turned that rule off and switched to Paragraph mode it started to work way quicker and I don’t think it crashes any more (even if I merge sentences).

The paragraph mode is a simpler check mode that does not perform cross-paragraph checks. The affected function is not used there.

To find the cause of the problem, I have to ask again:
What do you mean by ‘LibreOffice crashes’? Did LibreOffice really crash (shutdown), or did a LanguageTool window open with the error message? In the first case: Where does the error message come from?

LibreOffice app completely crashes (shuts down), the error I saw was in the log in ~/.config/LanguageTool/LibreOffice

From my point of view, it is a LibreOffice bug. There is a timing problem within the interface between the LO app and the LT extension. This should result in giving back a null, not in a crash.
I can’t reproduce the problem at my machine. So, I can’t run tests. I made a change in the code for a workaround. It is in tomorrow’s snapshot. Could you install the snapshot tomorrow and test it?

Thank you, is there a snapshot repo or shall I build it myself?

The snapshots are here: Index of /snapshots/.
Please test the latest OXT.

I’ve tried a bit more with latest SNAPSHOT and I think it was more stable, I went through ~60 pages and was about to say all good when I got another crash. I am attaching the log. Although I am not sure if the NPE caused actual crash (I guess not)
LanguageTool.txt (4.1 KB)

java.lang.NullPointerException: Cannot read field “Language” because “locale” is null
at org.languagetool.openoffice.OfficeTools.localeToString(OfficeTools.java:365)
at org.languagetool.openoffice.TextLevelCheckQueue.getLanguage(TextLevelCheckQueue.java:253)
at org.languagetool.openoffice.TextLevelCheckQueue$QueueIterator.run(TextLevelCheckQueue.java:611)

I think the NPE is not the reason of the crash, but I solved the problem. It is corrected in the snapshot tomorrow.

Thank you, I appreciate your help on this!!

Probably not too important, but I just opened a document in LibreOffice by mistake, so I closed before it even rendered and got LT exception:

MultiDocumentsHandler: setContextOfClosedDoc: Error: Disposed Document not found - Cache not deleted
com.sun.star.lang.DisposedException: at /builddir/build/BUILD/libreoffice-7.4.5.1/sfx2/source/doc/sfxbasemodel.cxx:2980
    at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method)
    at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:185)
    at jdk.proxy1/jdk.proxy1.$Proxy38.getCurrentController(Unknown Source)
    at org.languagetool.openoffice.SingleDocument.setDokumentListener(SingleDocument.java:1207)
    at org.languagetool.openoffice.SingleDocument.<init>(SingleDocument.java:135)
    at org.languagetool.openoffice.MultiDocumentsHandler.getNumDoc(MultiDocumentsHandler.java:797)
    at org.languagetool.openoffice.MultiDocumentsHandler.getCheckResults(MultiDocumentsHandler.java:223)
    at org.languagetool.openoffice.MultiDocumentsHandler.doProofreading(MultiDocumentsHandler.java:176)
    at org.languagetool.openoffice.Main.doProofreading(Main.java:81)