kopia lustrzana https://github.com/jameshball/osci-render
Prevent double-locking when using code editor
rodzic
b5cfc2824b
commit
a487306784
|
@ -136,16 +136,18 @@ void OscirenderAudioProcessorEditor::fileUpdated(juce::File file) {
|
|||
obj.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// parsersLock must be locked before calling this function
|
||||
void OscirenderAudioProcessorEditor::codeDocumentTextInserted(const juce::String& newText, int insertIndex) {
|
||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
||||
int index = audioProcessor.getCurrentFileIndex();
|
||||
juce::String file = codeDocuments[index]->getAllContent();
|
||||
audioProcessor.updateFileBlock(index, std::make_shared<juce::MemoryBlock>(file.toRawUTF8(), file.getNumBytesAsUTF8() + 1));
|
||||
updateCodeDocument();
|
||||
}
|
||||
|
||||
// parsersLock must be locked before calling this function
|
||||
void OscirenderAudioProcessorEditor::codeDocumentTextDeleted(int startIndex, int endIndex) {
|
||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
||||
updateCodeDocument();
|
||||
}
|
||||
|
||||
void OscirenderAudioProcessorEditor::updateCodeDocument() {
|
||||
int index = audioProcessor.getCurrentFileIndex();
|
||||
juce::String file = codeDocuments[index]->getAllContent();
|
||||
audioProcessor.updateFileBlock(index, std::make_shared<juce::MemoryBlock>(file.toRawUTF8(), file.getNumBytesAsUTF8() + 1));
|
||||
|
|
|
@ -47,6 +47,7 @@ private:
|
|||
|
||||
void codeDocumentTextInserted(const juce::String& newText, int insertIndex) override;
|
||||
void codeDocumentTextDeleted(int startIndex, int endIndex) override;
|
||||
void updateCodeDocument();
|
||||
|
||||
bool keyPressed(const juce::KeyPress& key) override;
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue