shutdown being called when NULL is passed to SetClientSite

54 views
Skip to first unread message

GeoffC

unread,
Feb 14, 2013, 6:12:46 PM2/14/13
to firebre...@googlegroups.com
Hi Richard,
 
I'm using FireBreath 1.7, from just a few days prior to your official 1.7 release (no particular reason, we were just up and running fine at that point).
 
We have a plugin that has no UI and is simply used to control external devices. I'm noticing that when our plugin is loaded, we get the PluginReady notification and receive a few commands from our web app to start our device initialization. Everything is proceeding well when it looks like the plugin is suddenly getting a SetClientSite command with a NULL pClientSite. Here's the code from FBControl.h:
 

template <const GUID* pFbCLSID, const char* pMT, class ICurObjInterface, const IID* piid, const GUID* plibid>
STDMETHODIMP CFBControl<pFbCLSID, pMT,ICurObjInterface,piid,plibid>::SetClientSite( IOleClientSite *pClientSite )
{
    HRESULT hr = IOleObjectImpl<CFBControlX>::SetClientSite (pClientSite);
    if (!pClientSite || !pluginMain) {
        shutdown();                          <--- SHUTDOWN IS GETTING CALLED
        return hr;
    }

    m_serviceProvider = pClientSite;
    if (!m_serviceProvider)
        return E_FAIL;
    m_serviceProvider->QueryService(SID_SWebBrowserApp, IID_IWebBrowser2, reinterpret_cast<void**>(&m_webBrowser));
    m_serviceProvider.Release();

    if (m_webBrowser) {
        m_propNotify = m_spClientSite;
    }

    clientSiteSet();

    return S_OK;
}

I'm using shutdown to clean up everything, so this is throwing a monkey wrench into our device initialization.

My questions are:

1) Does this somehow mean that the web app has closed or refreshed the page? (I suspect that the 3rd-party web app is starting our device initialization during the "page loaded" notification)

2) Should my non-UI plugin have to shutdown when there is no client site? If not, how can I tell when to "ignore" the shutdown notification in this case.

-- Geoff

 

Richard Bateman

unread,
Feb 14, 2013, 6:37:57 PM2/14/13
to firebre...@googlegroups.com

1) This is kinda a challenge, because basically what happens is that *usually* when that happens it means things are shutting down, but *sometimes* it then comes back up.  Probably what is happening is you have some css in your page that was changed that changed the container that your plugin was rendered in. For example, the "overflow", "display", or "visibility" of your plugin or an ancestor may have changed. There are likely other things that could cause this as well, but those are ones I remember causing weird issues like this.  Refreshing the page could do it too, of course.

2) I have no idea… this might be worth some more experimentation.

Richard

--
 
---
You received this message because you are subscribed to the Google Groups "firebreath-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebreath-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

GeoffC

unread,
Feb 15, 2013, 9:32:50 AM2/15/13
to firebre...@googlegroups.com
Thanks for getting back to me on this Richard. I think you're right about the the css as the page doesn't appear to refresh (we only select a checkbox to invoke some feature). This is tough as I can't do cleanup in the destructor of the plugin, so I need to figure out a way to definitively determine when the plugin is being unloaded.
 
-- Geoff

GeoffC

unread,
Feb 15, 2013, 9:49:41 AM2/15/13
to firebre...@googlegroups.com
Just an update, it looks like the plugin is indeed getting unloaded. I'll need to contact the web app developers to find out exactly what they are doing.
 
Thanks again for your assistance Richard.
 
-- Geoff
Reply all
Reply to author
Forward
0 new messages