Kaydet (Commit) 8cce6500 authored tarafından Caolán McNamara's avatar Caolán McNamara

avoid a global uno::Reference to the current XCommandEnvironment

because the Env is kept until we exit, which we get away with now. But we won't
get away with it if we set the parent window property of the InteractionHandler
belonging to the Env. Because we then end up trying to destroy the vcl dialog
well after all the vcl, etc infrastructure is torn down and crash on exit.

Here I'm assuming that its safe to use a WeakReference because we're just using
this to smuggle into the c-style callbacks a Reference to a Env currently
belonging to something else

Change-Id: I2d6b90ae23d5a24431dc49d4316bdc3194560403
üst efe57384
......@@ -22,8 +22,6 @@ using namespace std;
namespace cmis
{
css::uno::Reference< css::ucb::XCommandEnvironment>
AuthProvider::sm_xEnv;
bool AuthProvider::authenticationQuery( string& username, string& password )
{
if ( m_xEnv.is() )
......@@ -66,6 +64,18 @@ namespace cmis
return false;
}
css::uno::WeakReference< css::ucb::XCommandEnvironment> AuthProvider::sm_xEnv;
void AuthProvider::setXEnv(const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv )
{
sm_xEnv = xEnv;
}
css::uno::Reference< css::ucb::XCommandEnvironment> AuthProvider::getXEnv()
{
return sm_xEnv;
}
char* AuthProvider::onedriveAuthCodeFallback( const char* url,
const char* /*username*/,
const char* /*password*/ )
......
......@@ -12,13 +12,14 @@
#include <libcmis/libcmis.hxx>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <cppuhelper/weakref.hxx>
namespace cmis
{
class AuthProvider : public libcmis::AuthProvider
{
const css::uno::Reference< css::ucb::XCommandEnvironment>& m_xEnv;
static css::uno::Reference< css::ucb::XCommandEnvironment> sm_xEnv;
static css::uno::WeakReference< css::ucb::XCommandEnvironment> sm_xEnv;
OUString m_sUrl;
OUString m_sBindingUrl;
......@@ -38,9 +39,9 @@ namespace cmis
const char* /*username*/,
const char* /*password*/ );
static void setXEnv( const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv ) { sm_xEnv = xEnv; }
static void setXEnv( const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv );
static css::uno::Reference< css::ucb::XCommandEnvironment> getXEnv();
static const css::uno::Reference< css::ucb::XCommandEnvironment>& getXEnv( ) { return sm_xEnv; }
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment