Strange problem in CodeEditorComponent


#1

I don’t know what’s happening, but i’m getting strange crashes when editing some code in the editor component. I was not getting this yesterday, but i didn’t touched anything critical. It’s strange cause it now add 2 new lines instead of one when pressing and it messes up the syntax highlighting colours of the text before crash. this is in a vst plugin in linux.

#0 0x4f142904 in ?? () from /lib/ld-linux.so.2 #1 0x4f142f80 in ?? () from /lib/ld-linux.so.2 #2 0x4f147ec6 in ?? () from /lib/ld-linux.so.2 #3 0x4f14dcc0 in ?? () from /lib/ld-linux.so.2 #4 0xa22f25f1 in juce::ArrayAllocationBase<juce::UndoableAction*, juce::DummyCriticalSection>::~ArrayAllocationBase (this=0xa0a1cef0, __in_chrg=<value optimized out>) at ../sources/juce/../../libraries/juce/amalgamation/../src/containers/../text/../text/../containers/juce_ArrayAllocationBase.h:57 #5 0xa2328dfa in juce::OwnedArray<juce::UndoableAction, juce::DummyCriticalSection>::~OwnedArray (this=0xa0a1cef0, __in_chrg=<value optimized out>) at ../sources/juce/../../libraries/juce/amalgamation/../src/containers/../utilities/../containers/juce_OwnedArray.h:73 #6 0xa23295ec in juce::OwnedArray<juce::OwnedArray<juce::UndoableAction, juce::DummyCriticalSection>, juce::DummyCriticalSection>::removeRange (this=0x9d9d480, startIndex=3, numberToRemove=1, deleteObjects=true) at ../sources/juce/../../libraries/juce/amalgamation/../src/containers/../utilities/../containers/juce_OwnedArray.h:608 #7 0xa232971d in juce::OwnedArray<juce::OwnedArray<juce::UndoableAction, juce::DummyCriticalSection>, juce::DummyCriticalSection>::removeLast (this=0x9d9d480, howManyToRemove=1, deleteObjects=true) at ../sources/juce/../../libraries/juce/amalgamation/../src/containers/../utilities/../containers/juce_OwnedArray.h:643 #8 0xa22bcfba in juce::UndoManager::perform (this=0x9d9d464, command_=0xa0a15cf8, actionName=...) at ../sources/juce/../../libraries/juce/amalgamation/../src/utilities/juce_UndoManager.cpp:130 #9 0xa23979e0 in juce::CodeDocument::remove (this=0x9d9d44c, startPos=148, endPos=149, undoable=true) at ../sources/juce/../../libraries/juce/amalgamation/../src/gui/components/code_editor/juce_CodeDocument.cpp:894 #10 0xa2397fbc in juce::CodeDocument::deleteSection (this=0x9d9d44c, startPosition=..., endPosition=...) at ../sources/juce/../../libraries/juce/amalgamation/../src/gui/components/code_editor/juce_CodeDocument.cpp:547 #11 0xa23ac159 in juce::CodeEditorComponent::insertTextAtCaret (this=0x9ee5f94, newText=...) at ../sources/juce/../../libraries/juce/amalgamation/../src/gui/components/code_editor/juce_CodeEditorComponent.cpp:621 #12 0xa23581c2 in juce::CodeEditorComponent::cut (this=0x9ee5f94) at ../sources/juce/../../libraries/juce/amalgamation/../src/gui/components/code_editor/juce_CodeEditorComponent.cpp:651 #13 0xa23acc88 in juce::CodeEditorComponent::deleteForward (this=0x9ee5f94, moveInWholeWordSteps=false) at ../sources/juce/../../libraries/juce/amalgamation/../src/gui/components/code_editor/juce_CodeEditorComponent.cpp:852 ---Type <return> to continue, or q <return> to quit--- #14 0xa23adef5 in juce::CodeEditorComponent::keyPressed (this=0x9ee5f94, key=...) at ../sources/juce/../../libraries/juce/amalgamation/../src/gui/components/code_editor/juce_CodeEditorComponent.cpp:968 #15 0xa23a6b2e in juce::ComponentPeer::handleKeyPress (this=0x9eef490, keyCode=268435711, textCharacter=127 L'\177') at ../sources/juce/../../libraries/juce/amalgamation/../src/gui/components/windows/juce_ComponentPeer.cpp:193 #16 0xa247baab in juce::LinuxComponentPeer::handleKeyPressEvent(struct {...} * const) (this=0x9eef490, keyEvent=0xa1d37248) at ../sources/juce/../../libraries/juce/amalgamation/../src/native/linux/juce_linux_Windowing.cpp:1362 #17 0xa247fe11 in juce::LinuxComponentPeer::handleWindowMessage (this=0x9eef490, event=0xa1d37248) at ../sources/juce/../../libraries/juce/amalgamation/../src/native/linux/juce_linux_Windowing.cpp:1218 #18 0xa247263e in juce::juce_windowMessageReceive (event=0xa1d37248) at ../sources/juce/../../libraries/juce/amalgamation/../src/native/linux/juce_linux_Windowing.cpp:2679 #19 0xa24800f3 in juce::InternalMessageQueue::dispatchNextXEvent () at ../sources/juce/../../libraries/juce/amalgamation/../src/native/linux/juce_linux_Messaging.cpp:191 #20 0xa2486a65 in juce::InternalMessageQueue::dispatchNextEvent (this=0x9d8a540) at ../sources/juce/../../libraries/juce/amalgamation/../src/native/linux/juce_linux_Messaging.cpp:99 #21 0xa24776b4 in juce::juce_dispatchNextMessageOnSystemQueue (returnIfNoPendingMessages=true) at ../sources/juce/../../libraries/juce/amalgamation/../src/native/linux/juce_linux_Messaging.cpp:456 #22 0xa229b71e in juce::MessageManager::runDispatchLoopUntil (this=0x9d8a508, millisecondsToRunFor=250) at ../sources/juce/../../libraries/juce/amalgamation/../src/events/juce_MessageManager.cpp:155 #23 0xa249b423 in SharedMessageThread::run() () from /home/kraken/Projects/binaries/Debug/libtest.so #24 0xa21ffd9b in juce::Thread::threadEntryPoint (this=0x9d8a0c8) at ../sources/juce/../../libraries/juce/amalgamation/../src/threads/juce_Thread.cpp:135 #25 0xa21ffddd in juce::juce_threadEntryPoint (userData=0x9d8a0c8) at ../sources/juce/../../libraries/juce/amalgamation/../src/threads/juce_Thread.cpp:147 #26 0xa2474a7b in juce::threadEntryProc (userData=0x9d8a0c8) at ../sources/juce/../../libraries/juce/amalgamation/../src/native/linux/../common/juce_posix_SharedCode.h:714 #27 0x4f2dc6d0 in start_thread () from /lib/libpthread.so.0 #28 0x4f22cd5e in clone () from /lib/libc.so.6

any ideas ?


#2

Any way I could reproduce this myself…?


#3

Well, with the latest tip i’m getting this strange behaviour (and related asserts/crashes) with the unchanged JuceDemo.

i can make a binary to explain this better in case you are not able to replicate this.


#4

Thanks, I’m on the case, will check in a fix shortly…


#5

thanx man! i initially thought it was a problem of the new multibyte string, but indeed the strings inside the CodeDocument are correct, it’s the split of them in the component which got messed up.


#6

Checked in now - sorry, I thought I’d tested the code editor when I updated the string stuff, but obviously not!


#7

thanx again !