WebBrowserComponent Leaks (Win)


#1

Hi Jules.

You can clearly see it in the JuceDemo.

This issue was already mentioned in this post /viewtopic.php?f=2&t=4292&hilit=webbrowsercomponent+leak.

And you answered that in your code:

 JUCE_COMRESULT GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
        {
            /* Note: if you call AddRef on the frame here, then some types of object (e.g. web browser control) cause leaks..
               If you don't call AddRef then others crash (e.g. QuickTime).. Bit of a catch-22, so letting it leak is probably preferable.
            */
            if (lplpFrame != nullptr) { frame->AddRef(); *lplpFrame = frame; }
            if (lplpDoc != nullptr)   *lplpDoc = 0;
            lpFrameInfo->fMDIApp = FALSE;
            lpFrameInfo->hwndFrame = window;
            lpFrameInfo->haccel = 0;
            lpFrameInfo->cAccelEntries = 0;
            return S_OK;
        }

But can’t you prevent this leak by calling AddRef only to IE components or something like that?

Thanks


#2

I think Quicktime was at fault there, and since it’s clearly a moribund technology I’ll probably be able to ditch it soon and tidy that code up. Good idea though, I guess it could be turned into a Quicktime-specific hack… No time to experiment with it right now, but if you want to suggest a suitable hack, I’ll consider it!