diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-26 17:02:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-26 17:07:18 +0100 |
commit | 8cce65007b506da38ca79ee8b5cdd62a1460fddd (patch) | |
tree | e07075f9f28330f39726361650660a2d843a2853 | |
parent | efe57384953c2a9eeb5f8fd65c2d548759ef05f7 (diff) |
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
-rw-r--r-- | ucb/source/ucp/cmis/auth_provider.cxx | 14 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/auth_provider.hxx | 7 |
2 files changed, 16 insertions, 5 deletions
diff --git a/ucb/source/ucp/cmis/auth_provider.cxx b/ucb/source/ucp/cmis/auth_provider.cxx index 0c3e4c0ec52f..ea833b15c859 100644 --- a/ucb/source/ucp/cmis/auth_provider.cxx +++ b/ucb/source/ucp/cmis/auth_provider.cxx @@ -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*/ ) diff --git a/ucb/source/ucp/cmis/auth_provider.hxx b/ucb/source/ucp/cmis/auth_provider.hxx index e633e95bd012..c2d1e18e200b 100644 --- a/ucb/source/ucp/cmis/auth_provider.hxx +++ b/ucb/source/ucp/cmis/auth_provider.hxx @@ -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; } }; } |