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);
|
obj.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parsersLock must be locked before calling this function
|
||||||
void OscirenderAudioProcessorEditor::codeDocumentTextInserted(const juce::String& newText, int insertIndex) {
|
void OscirenderAudioProcessorEditor::codeDocumentTextInserted(const juce::String& newText, int insertIndex) {
|
||||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
updateCodeDocument();
|
||||||
int index = audioProcessor.getCurrentFileIndex();
|
|
||||||
juce::String file = codeDocuments[index]->getAllContent();
|
|
||||||
audioProcessor.updateFileBlock(index, std::make_shared<juce::MemoryBlock>(file.toRawUTF8(), file.getNumBytesAsUTF8() + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parsersLock must be locked before calling this function
|
||||||
void OscirenderAudioProcessorEditor::codeDocumentTextDeleted(int startIndex, int endIndex) {
|
void OscirenderAudioProcessorEditor::codeDocumentTextDeleted(int startIndex, int endIndex) {
|
||||||
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
|
updateCodeDocument();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OscirenderAudioProcessorEditor::updateCodeDocument() {
|
||||||
int index = audioProcessor.getCurrentFileIndex();
|
int index = audioProcessor.getCurrentFileIndex();
|
||||||
juce::String file = codeDocuments[index]->getAllContent();
|
juce::String file = codeDocuments[index]->getAllContent();
|
||||||
audioProcessor.updateFileBlock(index, std::make_shared<juce::MemoryBlock>(file.toRawUTF8(), file.getNumBytesAsUTF8() + 1));
|
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 codeDocumentTextInserted(const juce::String& newText, int insertIndex) override;
|
||||||
void codeDocumentTextDeleted(int startIndex, int endIndex) override;
|
void codeDocumentTextDeleted(int startIndex, int endIndex) override;
|
||||||
|
void updateCodeDocument();
|
||||||
|
|
||||||
bool keyPressed(const juce::KeyPress& key) override;
|
bool keyPressed(const juce::KeyPress& key) override;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue