# Crash in juce::Slider::getTextFromValue() while creating a new plugin instance

**URL:** <https://forum.juce.com/t/crash-in-juce-gettextfromvalue-while-creating-a-new-plugin-instance/29407>\
**Category:** Audio Plugins\
**Created:** [September 13, 2018, 7:26am UTC](https://forum.juce.com/t/crash-in-juce-gettextfromvalue-while-creating-a-new-plugin-instance/29407 "2018-09-13T07:26:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [September 13, 2018, 7:26am UTC](https://forum.juce.com/t/crash-in-juce-gettextfromvalue-while-creating-a-new-plugin-instance/29407/1 "2018-09-13T07:26:15Z")

</div>

A user reported following crash when opening the plug-in in Logic X:

`Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 ch.toguaudioline.talunolxv2 0x00000001221e7088 juce::Slider::getTextFromValue(double) + 8 1 ch.toguaudioline.talunolxv2 0x00000001221e5bff juce::Slider::Pimpl::lookAndFeelChanged(juce::LookAndFeel&) + 159 2 ch.toguaudioline.talunolxv2 0x00000001221e5637 juce::Slider::init(juce::Slider::SliderStyle, juce::Slider::TextEntryBoxPosition) + 135 3 ch.toguaudioline.talunolxv2 0x00000001221e54a9 juce::Slider::Slider() + 409 4 ch.toguaudioline.talunolxv2 0x00000001220a6f4e ServiceControlEntry::ServiceControlEntry() + 142 5 ch.toguaudioline.talunolxv2 0x00000001220a6a80 ServiceControlDialog::ServiceControlDialog() + 64 6 ch.toguaudioline.talunolxv2 0x000000012209fd64 TalScalableComponent::TalScalableComponent() + 164 7 ch.toguaudioline.talunolxv2 0x000000012209b9e5 TalComponent::TalComponent(TalCore*) + 53 8 ch.toguaudioline.talunolxv2 0x00000001220b79a2 TalCore::createEditor() + 34 9 ch.toguaudioline.talunolxv2 0x00000001220d09f8 juce::AudioProcessor::createEditorIfNeeded() + 72 10 ch.toguaudioline.talunolxv2 0x000000012208e371 JuceAU::JuceUICreationClass::uiViewForAudioUnit(objc_object*, objc_selector*,`

I’m not sure what the problem could be. I’m using the standard slider attachments attached to a slider. Can it have something to do with LookAndFeel::setDefaultLookAndFeel(talLookAndFeel); without using a static lookAndFeelClass? Unfortunately i can’t reproduce the issue on my system…  
Any help is welcome!

Edit: No SliderAttachments used in this case.  
It maybe crashes here:  
`owner.getTextFromValue (currentValue.getValue())`

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [September 13, 2018, 8:05am UTC](https://forum.juce.com/t/crash-in-juce-gettextfromvalue-while-creating-a-new-plugin-instance/29407/2 "2018-09-13T08:05:02Z")

</div>

I now call following constructor as a work around:

Slider(RotaryVerticalDrag, TextEntryBoxPosition::NoTextBox)

instead of

Slider()

This should fix the issue, because it does not call the crashing method. Not sure what the problem is. My sliders are on the stack. Maybe that’s not optimal too.

---

<div class="post-metadata">

**Author:** ![xenakios](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/xenakios/32/4047_2.png) [@xenakios](https://forum.juce.com/u/xenakios)\
**Post date:** [September 13, 2018, 10:01am UTC](https://forum.juce.com/t/crash-in-juce-gettextfromvalue-while-creating-a-new-plugin-instance/29407/3 "2018-09-13T10:01:47Z")

</div>

> [@kunz](#):
>
> My sliders are on the stack. Maybe that’s not optimal too.

How would you manage to have them on the stack in a plugin?

If you mean you have code like :

```auto
class MyEditor : public Component
{
  Slider m_volume;
  Slider m_pan;
};
```

That doesn’t mean the Sliders are on the stack if the editor is instantiated on the heap, which it normally would be for a JUCE AudioProcessor.

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [September 13, 2018, 10:23am UTC](https://forum.juce.com/t/crash-in-juce-gettextfromvalue-while-creating-a-new-plugin-instance/29407/4 "2018-09-13T10:23:25Z")

</div>

Thanks for the information. They aren’t on the stack then. It’s like in your example. I just don’t use new to create them.

---

<div class="post-metadata">

**Author:** ![kunz](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@kunz](https://forum.juce.com/u/kunz)\
**Post date:** [September 13, 2018, 11:01am UTC](https://forum.juce.com/t/crash-in-juce-gettextfromvalue-while-creating-a-new-plugin-instance/29407/5 "2018-09-13T11:01:14Z")

</div>

I just did see that i do not init the parameters like described in this thread:

> [@Jassert (object != nullptr); // Trying to add a property to a null ValueTree will fail!](https://forum.juce.com/t/jassert-object-nullptr-trying-to-add-a-property-to-a-null-valuetree-will-fail/27674/4):
>
> The issue can easily be reproduced by creating an AudioProcessorValueTreeState and calling createAndAddParameter() without subsequently assigning an initialised ValueTree to AudioProcessorValueTreeState::state. The docs say: To use: 1) Create an AudioProcessorValueTreeState, and give it some parameters using createAndAddParameter(). 2) Initialise the state member variable with a type name. But in JUCE 5.3.1 you could get away with not performing ‘2’. However, in JUCE 5.3.2 you get a cras…

I missed this one:  
paramState.state = ValueTree(“Foo”);

Maybe thats the source of the issue…
