# Deadlock message manager lock when a plugin host another juce plugin

**URL:** <https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445>\
**Category:** Linux\
**Created:** [September 1, 2015, 11:55am UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445 "2015-09-01T11:55:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [September 1, 2015, 11:55am UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445/1 "2015-09-01T11:55:45Z")

</div>

I've discovered that in a JUCE VST plugin, if i host another JUCE plugin and open&nbsp;its editor in an external window, a deadlock may or may not occur cause of a MessageManagerLock wait indefinately. This does not occur if i host a plugin not done in JUCE.

juce\_VSTPluginFormat.cpp line 1287:

```
case audioMasterSizeWindow:
    if (AudioProcessorEditor* ed = getActiveEditor())
    {
       #if JUCE_LINUX
        const MessageManagerLock mmLock;
       #endif
        ed->setSize (index, (int) value);
    }
    
    return 1;
```

This creates a deadlock cause dispatcher function in juce\_VST\_Wrapper.cpp does lock the message thread when opening and closing the plugin gui...

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 1, 2015, 12:02pm UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445/2 "2015-09-01T12:02:32Z")

</div>

Maybe you've not stripped symbols in your host, so there's some cross-linkage internally of common juce static values.

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [September 1, 2015, 12:23pm UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445/3 "2015-09-01T12:23:00Z")

</div>

ah that could be, as i'm debugging so all symbols are there.

is there a way to avoid it&nbsp;?

would rename the juce namespace to something else work to avoid&nbsp;clashes ?

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [September 1, 2015, 1:02pm UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445/4 "2015-09-01T13:02:36Z")

</div>

it seems that adding **-fno-leading-underscore** to gcc helps.

is there a way to have _Extra compiler&nbsp;flags_ for each target in Introjucer ? i would like to add the flag&nbsp;only in debug builds...&nbsp;

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 1, 2015, 1:20pm UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445/5 "2015-09-01T13:20:07Z")

</div>

I suspect that that only _seems_ to help, because it'll change the names of the symbols and avoid some clashes, but that's missing the point - you really need to make sure the symbols really aren't visible externally.

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [September 1, 2015, 2:08pm UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445/6 "2015-09-01T14:08:17Z")

</div>

yes, but how to do that when debugging ?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [September 1, 2015, 2:13pm UTC](https://forum.juce.com/t/deadlock-message-manager-lock-when-a-plugin-host-another-juce-plugin/15445/7 "2015-09-01T14:13:42Z")

</div>

Well, either the host or plugin should be stripped. As long as you're only debugging one or other of them, that should be possible.
