Trying to add FilenameComponent and TextEditor to audio plugin, getting "Exception thrown: read access violation. this was 0x20."

I followed this tutorial to add a FilenameComponent and TextEditor to my audio plugin, but when I run it, I get:
Exception thrown: read access violation. this was 0x20.
I found this error occurs when I have the line:
fileComp->setBounds (10, 10, getWidth() - 20, 20);
or the line:
textContent->setBounds (10, 40, getWidth() - 20, getHeight() - 50);
in the resized method of the AudioProcessorEditor derived class. These lines are found in the demo header file.

I searched and I cannot find out why. I suppose, what is different to consider when adding one of these components to an audio plugin vs a standalone application? I tried the demo out and it worked fine, so it has to be something with it being an audio plugin.

My stack trace is:

FSynth.vst3!juce::Rectangle::getWidth() Line 106 C++
FSynth.vst3!juce::Component::getWidth() Line 271 C++
FSynth.vst3!juce::Component::setBounds(int x, int y, int w, int h) Line 1073 C++
FSynth.vst3!FsynthAudioProcessorEditor::resized() Line 79 C++
FSynth.vst3!juce::Component::sendMovedResizedMessages(bool wasMoved, bool wasResized) Line 1149 C++
FSynth.vst3!juce::Component::sendMovedResizedMessagesIfPending() Line 1131 C++
FSynth.vst3!juce::Component::setBounds(int x, int y, int w, int h) Line 1117 C++
FSynth.vst3!juce::Component::setSize(int w, int h) Line 1170 C++
FSynth.vst3!FsynthAudioProcessorEditor::FsynthAudioProcessorEditor(FsynthAudioProcessor & p) Line 23 C++
FSynth.vst3!FsynthAudioProcessor::createEditor() Line 194 C++
FSynth.vst3!juce::AudioProcessor::createEditorIfNeeded() Line 829 C++
FSynth.vst3!juce::JuceVST3EditController::JuceVST3Editor::ContentWrapperComponent::ContentWrapperComponent(juce::JuceVST3EditController::JuceVST3Editor & editor, juce::AudioProcessor & plugin) Line 1340 C++
FSynth.vst3!juce::JuceVST3EditController::JuceVST3Editor::JuceVST3Editor(juce::JuceVST3EditController & ec, juce::AudioProcessor & p) Line 1040 C++
FSynth.vst3!juce::JuceVST3EditController::createView(const char * name) Line 863 C++
[External Code]

I noticed at the time of the stack trace, the program is unable to read the variables: w, h, pos.x, and pos.y. It says for those variables, <Unable to read memory>.

My resized method looks like this currently:
void FsynthAudioProcessorEditor::resized()
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
//midiVolume.setBounds(40, 30, 20, getHeight() - 60);
//fileComp->setBounds(10, 10, getWidth() - 20, 20);
textContent->setBounds(10, 40, getWidth() - 20, getHeight() - 50);
I have the lines commented out as I was trying to see what was causing the error.

You are probably calling setSize in your editor’s constructor before you have created the components the resized() method is using.

Thanks! That was exactly the issue.