Timer checks for VST plugin editor size resulting in wrong display

There is a, somewhat strange, piece of code within juce_VSTPluginFormat.cpp around line #2230 (This is Windows only btw.)

if (--sizeCheckCount <= 0)
    sizeCheckCount = 10;

So this is using a magic number 10 and then every 10 timer ticks it tries to determine the plugin editor size using the plugin editor’s window handle…

Roland’s Sound Canvas plugin, for example, can change its height based on some buttons you can push. When that happens - the plugin correctly calls the appropriate callback to notify the host that its size changed and host can perform the adjustments.

So host resizes the window containing the plugin’s UI, but then this timer gets called shrinks back the size to the original size without additional UI components. This is happening because this call to ‘checkPluginWindowSize()’ is using a window handle of just the initial part of the plugin window (the top part) while the new part that showed up when we pushed this button has a separate handle. This makes the plugin editor unusable.

Is this call to check the size really needed? Looks like a hack to deal with some badly written plugins that wouldn’t properly execute the appropriate callbacks when their size changes. If that’s the case - I think it should be removed.

While we’re on this subject - some plugins like the Roland Sound Canvas seems to be using a window handle of the container window to calculate position of its internal components. So even if one parents this plugin’s window to a separate component - if that component is not at position (0, 0) of the actual window containing it - the plugin UI gets all messed up as it seems to be calculating its position relative to the parent window, not the parent component.

Did anyone come across this issue? Any suggestions?