desktop/source/app/officeipcthread.cxx | 9 +- desktop/source/app/officeipcthread.hxx | 2 vcl/inc/aqua/saldata.hxx | 1 vcl/inc/ios/saldata.hxx | 1 vcl/inc/salsession.hxx | 8 +- vcl/inc/svdata.hxx | 13 ---- vcl/inc/unx/salframe.h | 5 - vcl/inc/unx/sm.hxx | 32 +++------- vcl/inc/unx/wmadaptor.hxx | 1 vcl/inc/win/saldata.hxx | 1 vcl/source/app/session.cxx | 91 ++++++++++++---------------- vcl/source/components/factory.cxx | 2 vcl/unx/generic/app/sm.cxx | 101 +++++++++++++------------------- vcl/unx/generic/app/wmadaptor.cxx | 1 vcl/unx/generic/window/salframe.cxx | 104 --------------------------------- vcl/win/source/app/salinst.cxx | 2 16 files changed, 111 insertions(+), 263 deletions(-)
New commits: commit bd91d9319efb7fcf0e5861e66ab5ea9e5630bf3f Author: Stephan Bergmann <[email protected]> Date: Wed Jun 20 14:37:43 2012 +0200 Avoid deadlock when signal handler joins thread ...as the signal can potentially be delivered to the to-be-joined thread. (It is unclear to me whether the SalMainPipeExchangeSingal_impl handler is really needed anyway, as there are various other places that should ensure that DisableOfficeIPCThread is called during shutdown. At least in theory, no longer joining here can cause the thread to incur crashes etc. when it it still running during shutdown.) Change-Id: I677a2e31e1a58d2b8d91634c2eb5274d63ac15f4 diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index e99eb1d..d90aa27 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -297,7 +297,7 @@ void ImplPostProcessDocumentsEvent( ProcessDocumentsRequest* pEvent ) oslSignalAction SAL_CALL SalMainPipeExchangeSignal_impl(void* /*pData*/, oslSignalInfo* pInfo) { if( pInfo->Signal == osl_Signal_Terminate ) - OfficeIPCThread::DisableOfficeIPCThread(); + OfficeIPCThread::DisableOfficeIPCThread(false); return osl_Signal_ActCallNextHdl; } @@ -575,7 +575,7 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() return IPC_STATUS_OK; } -void OfficeIPCThread::DisableOfficeIPCThread() +void OfficeIPCThread::DisableOfficeIPCThread(bool join) { osl::ClearableMutexGuard aMutex( GetMutex() ); @@ -604,7 +604,10 @@ void OfficeIPCThread::DisableOfficeIPCThread() OfficeIPCThread::SetReady(pOfficeIPCThread); // exit gracefully and join - pOfficeIPCThread->join(); + if (join) + { + pOfficeIPCThread->join(); + } } } diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx index f60a134..5dc03bc 100644 --- a/desktop/source/app/officeipcthread.hxx +++ b/desktop/source/app/officeipcthread.hxx @@ -128,7 +128,7 @@ class OfficeIPCThread : public salhelper::Thread // return sal_False if second office static Status EnableOfficeIPCThread(); - static void DisableOfficeIPCThread(); + static void DisableOfficeIPCThread(bool join = true); // start dispatching events... static void SetReady( rtl::Reference< OfficeIPCThread > const & pThread = commit 97beabccb73321a8d2e022705afa755f15e99fa0 Author: Stephan Bergmann <[email protected]> Date: Wed Jun 20 12:09:12 2012 +0200 Work around false valgrind warning about optimized strlen implementation ...that reads in word sized chunks and thus can read past the nominal end of a memory buffer. Also, the return type of rtl_str_getLength (sal_Int32) fits better with the type of SmPropValue.length (int) than the return type of strlen (size_t). Change-Id: I7ff91408b4c6d8c9913cede516586f42b8349ed3 diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 185e550..a897805 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -220,7 +220,7 @@ static void BuildSmPropertyList() pSmProps[ 3 ].num_vals = 1; pSmProps[ 3 ].vals = new SmPropValue; pSmProps[ 3 ].vals->value = strdup( aUser.getStr() ); - pSmProps[ 3 ].vals->length = strlen( (char *)pSmProps[ 3 ].vals->value )+1; + pSmProps[ 3 ].vals->length = rtl_str_getLength( (char *)pSmProps[ 3 ].vals->value )+1; pSmProps[ 4 ].name = const_cast<char*>(SmRestartStyleHint); pSmProps[ 4 ].type = const_cast<char*>(SmCARD8); commit c0823c29a053011daa563183d7bc46add9b88eec Author: Stephan Bergmann <[email protected]> Date: Tue Jun 19 15:23:58 2012 +0200 pOldStyleSaveFrame is never set anyway ...so rip out all the corresponding, apparently obsolete, functionality. Change-Id: Ie1ca3fcf7f729464e4c11070caafc90a34da2d68 diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index f03f0e5..cced9d6 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -64,8 +64,6 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame friend class vcl_sal::NetWMAdaptor; friend class vcl_sal::GnomeWMAdaptor; - static X11SalFrame* s_pSaveYourselfFrame; - X11SalFrame* mpParent; // pointer to parent frame // which should never obscur this frame bool mbTransientForRoot; @@ -167,8 +165,6 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame DECL_LINK( HandleAlwaysOnTopRaise, void* ); - void passOnSaveYourSelf(); - void createNewWindow( XLIB_Window aParent, SalX11Screen nXScreen = SalX11Screen( -1 ) ); void updateScreenNumber(); @@ -278,7 +274,6 @@ public: // done setting up the clipregion virtual void EndSetClipRegion(); - static void SaveYourselfDone( SalFrame* ); static Bool checkKeyReleaseForRepeat( Display*, XEvent*, XPointer pX11SalFrame ); /// @internal diff --git a/vcl/inc/unx/wmadaptor.hxx b/vcl/inc/unx/wmadaptor.hxx index 5848c65..810c339 100644 --- a/vcl/inc/unx/wmadaptor.hxx +++ b/vcl/inc/unx/wmadaptor.hxx @@ -106,7 +106,6 @@ public: WM_PROTOCOLS, WM_DELETE_WINDOW, WM_TAKE_FOCUS, - WM_SAVE_YOURSELF, WM_CLIENT_LEADER, WM_COMMAND, WM_LOCALE_NAME, diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 8ba6e9c..185e550 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -63,8 +63,10 @@ namespace { class IceSalSession : public SalSession { public: - IceSalSession(); - virtual ~IceSalSession(); + IceSalSession() {} + +private: + virtual ~IceSalSession() {} virtual void queryInteraction(); virtual void interactionDone(); @@ -81,20 +83,6 @@ SalSession* X11SalInstance::CreateSalSession() return p; } -/* - * class IceSalSession - */ - -static X11SalFrame* pOldStyleSaveFrame = NULL; - -IceSalSession::IceSalSession() -{ -} - -IceSalSession::~IceSalSession() -{ -} - void IceSalSession::queryInteraction() { if( ! SessionManagerClient::queryInteraction() ) @@ -112,11 +100,6 @@ void IceSalSession::interactionDone() void IceSalSession::saveDone() { SessionManagerClient::saveDone(); - if( pOldStyleSaveFrame ) - { - // note: does nothing if not running in generic plugin - X11SalFrame::SaveYourselfDone( pOldStyleSaveFrame ); - } } bool IceSalSession::cancelShutdown() diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 8b9b278..a0791e0 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -171,7 +171,6 @@ static const WMAdaptorProtocol aAtomTab[] = { "WM_PROTOCOLS", WMAdaptor::WM_PROTOCOLS }, { "WM_DELETE_WINDOW", WMAdaptor::WM_DELETE_WINDOW }, { "WM_TAKE_FOCUS", WMAdaptor::WM_TAKE_FOCUS }, - { "WM_SAVE_YOURSELF", WMAdaptor::WM_SAVE_YOURSELF }, { "WM_COMMAND", WMAdaptor::WM_COMMAND }, { "WM_CLIENT_LEADER", WMAdaptor::WM_CLIENT_LEADER }, { "WM_LOCALE_NAME", WMAdaptor::WM_LOCALE_NAME }, diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 549616c..0a76ff3 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -108,8 +108,6 @@ static XLIB_Window hPresentationWindow = None, hPresFocusWindow = None; static ::std::list< XLIB_Window > aPresentationReparentList; static int nVisibleFloats = 0; -X11SalFrame* X11SalFrame::s_pSaveYourselfFrame = NULL; - // -=-= C++ statics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= static void doReparentPresentationDialogues( SalDisplay* pDisplay ) @@ -530,17 +528,11 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, SalX11Screen nXScreen, SystemP { XSetWMHints( GetXDisplay(), mhWindow, &Hints ); // WM Protocols && internals - Atom a[4]; + Atom a[3]; int n = 0; a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW ); if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) ) a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ); - if( ! s_pSaveYourselfFrame && ! mpParent) - { - // at all times have only one frame with SaveYourself - a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_SAVE_YOURSELF ); - s_pSaveYourselfFrame = this; - } if( (nSalFrameStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_TAKE_FOCUS ); XSetWMProtocols( GetXDisplay(), GetShellWindow(), a, n ); @@ -731,39 +723,6 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, sal_uLong nSalFrameStyle, Init( nSalFrameStyle, GetDisplay()->GetDefaultXScreen(), pSystemParent ); } -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -void X11SalFrame::passOnSaveYourSelf() -{ - if( this == s_pSaveYourselfFrame ) - { - // pass on SaveYourself - const X11SalFrame* pFrame = NULL; - const std::list< SalFrame* >& rFrames = GetDisplay()->getFrames(); - std::list< SalFrame* >::const_iterator it = rFrames.begin(); - while( it != rFrames.end() ) - { - pFrame = static_cast< const X11SalFrame* >(*it); - if( ! ( IsChildWindow() || pFrame->mpParent ) - && pFrame != s_pSaveYourselfFrame ) - break; - ++it; - } - - s_pSaveYourselfFrame = (it != rFrames.end() ) ? const_cast<X11SalFrame*>(pFrame) : NULL; - if( s_pSaveYourselfFrame ) - { - Atom a[4]; - int n = 0; - a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW ); - a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_SAVE_YOURSELF ); - if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) ) - a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ); - XSetWMProtocols( GetXDisplay(), s_pSaveYourselfFrame->GetShellWindow(), a, n ); - } - } -} - X11SalFrame::~X11SalFrame() { notifyDelete(); @@ -842,8 +801,6 @@ X11SalFrame::~X11SalFrame() && ++sit == GetDisplay()->getFrames().end() ) vcl::I18NStatus::free(); } - - passOnSaveYourSelf(); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -2637,8 +2594,6 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, SalX11Screen nXScreen XDestroyWindow( GetXDisplay(), mhWindow ); mhWindow = None; - passOnSaveYourSelf(); - // now init with new parent again if ( aParentData.aWindow != None ) Init( nStyle_ | SAL_FRAME_STYLE_PLUG, nXScreen, &aParentData ); @@ -4001,23 +3956,6 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent ) "ownerdraw" : "NON OWNERDRAW" ); #endif } - else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) ) - { - if( this == s_pSaveYourselfFrame ) - { - rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding())); - const char* argv[2]; - argv[0] = "/bin/sh"; - argv[1] = const_cast<char*>(aExec.getStr()); - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); - #endif - XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 ); - } - else - // can only happen in race between WM and window closing - XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 ); - } } } else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::XEMBED ) && @@ -4040,46 +3978,6 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent ) return 0; } -void X11SalFrame::SaveYourselfDone( SalFrame* pSaveFrame ) -{ - // session save was done, inform dtwm - if( s_pSaveYourselfFrame && pSaveFrame ) - { - rtl::OString aExec(rtl::OUStringToOString(SessionManagerClient::getExecName(), osl_getThreadTextEncoding())); - const char* argv[2]; - argv[0] = "/bin/sh"; - argv[1] = const_cast<char*>(aExec.getStr()); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); -#endif - XSetCommand( s_pSaveYourselfFrame->GetXDisplay(), - s_pSaveYourselfFrame->GetShellWindow(), - (char**)argv, 2 ); - if( pSaveFrame != s_pSaveYourselfFrame ) - { - // check if it still exists - const X11SalFrame* pFrame = NULL; - const std::list< SalFrame* >& rFrames = static_cast<X11SalFrame*>(pSaveFrame)->GetDisplay()->getFrames(); - std::list< SalFrame* >::const_iterator it = rFrames.begin(); - while( it != rFrames.end() ) - { - pFrame = static_cast< const X11SalFrame* >(*it); - if( pFrame == pSaveFrame ) - break; - ++it; - } - if( pFrame == pSaveFrame ) - { - const WMAdaptor& rWMAdaptor( *pFrame->pDisplay_->getWMAdaptor() ); - XChangeProperty( pFrame->GetXDisplay(), - pFrame->GetShellWindow(), - rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 ); - } - } - s_pSaveYourselfFrame->ShutDown(); - } -} - // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= extern "C" commit 5c9872de884bcc3f1ec7cd6901b9440eec270d6d Author: Stephan Bergmann <[email protected]> Date: Tue Jun 19 13:14:43 2012 +0200 Move IceSalSession declaration to sm.cxx Change-Id: I532e27b873e011aacebc1dd405de6d2e182ca3d4 diff --git a/vcl/inc/unx/sm.hxx b/vcl/inc/unx/sm.hxx index 8e47c9a..13291d1 100644 --- a/vcl/inc/unx/sm.hxx +++ b/vcl/inc/unx/sm.hxx @@ -28,14 +28,19 @@ #ifndef _VCL_SM_HXX #define _VCL_SM_HXX -#include <rtl/string.hxx> -#include <rtl/ustring.hxx> -#include "tools/link.hxx" -#include "unx/salunx.h" +#include "sal/config.h" + #include <X11/SM/SMlib.h> -#include "salsession.hxx" + +#include "tools/link.hxx" #include "vclpluginapi.h" +namespace rtl { + class OString; + class OUString; +} +class SalSession; + class SessionManagerClient { static SalSession * m_pSession; @@ -77,20 +82,6 @@ public: static VCLPLUG_GEN_PUBLIC const rtl::OString& getSessionID(); }; -class SalFrame; - -class IceSalSession : public SalSession -{ -public: - IceSalSession(); - virtual ~IceSalSession(); - - virtual void queryInteraction(); - virtual void interactionDone(); - virtual void saveDone(); - virtual bool cancelShutdown(); -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 1f8debf..8ba6e9c 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -56,6 +56,24 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> +#include "salsession.hxx" + +namespace { + +class IceSalSession : public SalSession +{ +public: + IceSalSession(); + virtual ~IceSalSession(); + + virtual void queryInteraction(); + virtual void interactionDone(); + virtual void saveDone(); + virtual bool cancelShutdown(); +}; + +} + SalSession* X11SalInstance::CreateSalSession() { SalSession * p = new IceSalSession; commit 34a3f6e8b7604612749d4f700a5db6d380bd0829 Author: Stephan Bergmann <[email protected]> Date: Tue Jun 19 13:08:06 2012 +0200 Move pOneInstance to SessionManagerClient::m_pSession Change-Id: I264d978fe3db9ab7eedf79351f70cee194ef792c diff --git a/vcl/inc/unx/sm.hxx b/vcl/inc/unx/sm.hxx index d3cf9ab..8e47c9a 100644 --- a/vcl/inc/unx/sm.hxx +++ b/vcl/inc/unx/sm.hxx @@ -38,6 +38,7 @@ class SessionManagerClient { + static SalSession * m_pSession; static SmcConn aSmcConnection; static rtl::OString m_aClientID; static bool bDocSaveDone; @@ -64,7 +65,7 @@ class SessionManagerClient DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* ); DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* ); public: - static void open(); // needed by other plugins, so export + static void open(SalSession * pSession); static void close(); static bool checkDocumentsSaved(); diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 5a05c8d..1f8debf 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -26,6 +26,10 @@ * ************************************************************************/ +#include "sal/config.h" + +#include <cassert> + #include <string.h> #include <unistd.h> #include <sys/poll.h> @@ -52,14 +56,11 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> -static IceSalSession* pOneInstance = NULL; - SalSession* X11SalInstance::CreateSalSession() { - if( ! pOneInstance ) - pOneInstance = new IceSalSession(); - SessionManagerClient::open(); - return pOneInstance; + SalSession * p = new IceSalSession; + SessionManagerClient::open(p); + return p; } /* @@ -74,8 +75,6 @@ IceSalSession::IceSalSession() IceSalSession::~IceSalSession() { - if( pOneInstance == this ) - pOneInstance = NULL; } void IceSalSession::queryInteraction() @@ -135,6 +134,7 @@ public: }; +SalSession * SessionManagerClient::m_pSession = 0; SmcConn SessionManagerClient::aSmcConnection = NULL; rtl::OString SessionManagerClient::m_aClientID; sal_Bool ICEConnectionObserver::bIsWatching = sal_False; @@ -273,10 +273,10 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, SaveYourselfHdl, void*, pStat } } - if( pOneInstance ) + if( m_pSession ) { SalSessionSaveRequestEvent aEvent( shutdown, false ); - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } else saveDone(); @@ -287,10 +287,10 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, SaveYourselfHdl, void*, pStat IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, InteractionHdl, void*, EMPTYARG ) { SAL_INFO("vcl.sm", "interaction link"); - if( pOneInstance ) + if( m_pSession ) { SalSessionInteractionEvent aEvent( true ); - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } return 0; @@ -299,10 +299,10 @@ IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, InteractionHdl, void*, EMPTYA IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownCancelHdl, void*, EMPTYARG ) { SAL_INFO("vcl.sm", "shutdown cancel"); - if( pOneInstance ) + if( m_pSession ) { SalSessionShutdownCancelEvent aEvent; - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } return 0; @@ -348,10 +348,10 @@ void SessionManagerClient::SaveYourselfProc( IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG ) { - if( pOneInstance ) + if( m_pSession ) { SalSessionQuitEvent aEvent; - pOneInstance->CallCallback( &aEvent ); + m_pSession->CallCallback( &aEvent ); } const std::list< SalFrame* >& rFrames = GetGenericData()->GetSalDisplay()->getFrames(); @@ -414,8 +414,11 @@ void SessionManagerClient::saveDone() } -void SessionManagerClient::open() +void SessionManagerClient::open(SalSession * pSession) { + assert(!m_pSession); + m_pSession = pSession; + static SmcCallbacks aCallbacks; // this is the way Xt does it, so we can too commit c83a393ffe5c80afd18f215f70af3e152d51a6bd Author: Stephan Bergmann <[email protected]> Date: Tue Jun 19 12:43:10 2012 +0200 Clean up how nStateVal is smuggled in Change-Id: Ib27bce3d6d20dd8ea81dc51f1501774cd313b5da diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 843e039..5a05c8d 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -241,10 +241,10 @@ bool SessionManagerClient::checkDocumentsSaved() return bDocSaveDone; } -IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG ) +IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, SaveYourselfHdl, void*, pStateVal ) { - //decode argument smuggled in by abusing pThis member of SessionManagerClient - sal_uIntPtr nStateVal = (sal_uIntPtr)pThis; + // Decode argument smuggled in as void*: + sal_uIntPtr nStateVal = reinterpret_cast< sal_uIntPtr >(pStateVal); Bool shutdown = nStateVal != 0; SAL_INFO("vcl.sm", "posting save documents event shutdown = " << (shutdown ? "true" : "false" )); @@ -340,9 +340,9 @@ void SessionManagerClient::SaveYourselfProc( SessionManagerClient::saveDone(); return; } - //Smuggle argument in by abusing pThis member of SessionManagerClient - sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0; - Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) ); + // Smuggle argument in as void*: + sal_uIntPtr nStateVal = shutdown; + Application::PostUserEvent( STATIC_LINK( 0, SessionManagerClient, SaveYourselfHdl ), reinterpret_cast< void * >(nStateVal) ); SAL_INFO("vcl.sm", "waiting for save yourself event to be processed" ); } commit 43a8d203d816321dccbaec38b6e8307f98f0249d Author: Stephan Bergmann <[email protected]> Date: Tue Jun 19 11:59:01 2012 +0200 Mutex lifecycle must encompass WeakComponentImplHelper base Change-Id: I98a9a22ce1e937b20bcd3b59b4e6677a5a60f762 diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index 0ac6bff..045d976 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -61,7 +61,9 @@ SalSession::~SalSession() { } -class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient > +class VCLSession: + private osl::Mutex, + public cppu::WeakComponentImplHelper1 < XSessionManagerClient > { struct Listener { @@ -80,7 +82,6 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient std::list< Listener > m_aListeners; boost::scoped_ptr< SalSession > m_pSession; - osl::Mutex m_aMutex; bool m_bInteractionRequested; bool m_bInteractionGranted; bool m_bInteractionDone; @@ -107,7 +108,7 @@ public: }; VCLSession::VCLSession() - : cppu::WeakComponentImplHelper1< XSessionManagerClient >( m_aMutex ), + : cppu::WeakComponentImplHelper1< XSessionManagerClient >( *static_cast< osl::Mutex * >(this) ), m_pSession( ImplGetSVData()->mpDefInst->CreateSalSession() ), m_bInteractionRequested( false ), m_bInteractionGranted( false ), @@ -122,7 +123,7 @@ void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable ) { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // reset listener states for( std::list< Listener >::iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) @@ -159,7 +160,7 @@ void VCLSession::callInteractionGranted( bool bInteractionGranted ) { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // copy listener list since calling a listener may remove it. for( std::list< Listener >::const_iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) if( it->m_bInteractionRequested ) @@ -188,7 +189,7 @@ void VCLSession::callShutdownCancelled() { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // copy listener list since calling a listener may remove it. aListeners = m_aListeners; // set back interaction state @@ -205,7 +206,7 @@ void VCLSession::callQuit() { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // copy listener list since calling a listener may remove it. aListeners = m_aListeners; // set back interaction state @@ -250,14 +251,14 @@ void VCLSession::SalSessionEventProc( void* pData, SalSessionEvent* pEvent ) void SAL_CALL VCLSession::addSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); m_aListeners.push_back( Listener( xListener ) ); } void SAL_CALL VCLSession::removeSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); std::list< Listener >::iterator it = m_aListeners.begin(); while( it != m_aListeners.end() ) @@ -283,7 +284,7 @@ void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference<XSessionMa return; } - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); if( ! m_bInteractionRequested ) { m_pSession->queryInteraction(); @@ -301,7 +302,7 @@ void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference<XSessionMa void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); int nRequested = 0, nDone = 0; for( std::list< Listener >::iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) { @@ -324,7 +325,7 @@ void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionMa void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); bool bSaveDone = true; for( std::list< Listener >::iterator it = m_aListeners.begin(); commit e100891fecc777f0d25aef9044373633ae6a34af Author: Stephan Bergmann <[email protected]> Date: Tue Jun 19 11:28:42 2012 +0200 Some clean up Change-Id: Ib8ed8c866eece8a57a5532a65d1229e5dd92a422 diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index 47a39d8..0ac6bff 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -26,7 +26,9 @@ * ************************************************************************/ +#include "sal/config.h" +#include <boost/scoped_ptr.hpp> #include <cppuhelper/compbase1.hxx> #include <tools/debug.hxx> @@ -77,7 +79,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient }; std::list< Listener > m_aListeners; - SalSession* m_pSession; + boost::scoped_ptr< SalSession > m_pSession; osl::Mutex m_aMutex; bool m_bInteractionRequested; bool m_bInteractionGranted; @@ -86,13 +88,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient static void SalSessionEventProc( void* pData, SalSessionEvent* pEvent ); - void callSaveRequested( bool bShutdown, bool bCancelable ); - void callShutdownCancelled(); - void callInteractionGranted( bool bGranted ); - void callQuit(); -public: - VCLSession(); - virtual ~VCLSession(); + virtual ~VCLSession() {} virtual void SAL_CALL addSessionManagerListener( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); virtual void SAL_CALL removeSessionManagerListener( const css::uno::Reference< XSessionManagerListener>& xListener ) throw( RuntimeException ); @@ -100,25 +96,28 @@ public: virtual void SAL_CALL interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); virtual void SAL_CALL saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ); virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException ); + + void callSaveRequested( bool bShutdown, bool bCancelable ); + void callShutdownCancelled(); + void callInteractionGranted( bool bGranted ); + void callQuit(); + +public: + VCLSession(); }; VCLSession::VCLSession() : cppu::WeakComponentImplHelper1< XSessionManagerClient >( m_aMutex ), + m_pSession( ImplGetSVData()->mpDefInst->CreateSalSession() ), m_bInteractionRequested( false ), m_bInteractionGranted( false ), m_bInteractionDone( false ), m_bSaveDone( false ) { - m_pSession = ImplGetSVData()->mpDefInst->CreateSalSession(); if( m_pSession ) m_pSession->SetCallback( SalSessionEventProc, this ); } -VCLSession::~VCLSession() -{ - delete m_pSession; -} - void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable ) { std::list< Listener > aListeners; @@ -138,7 +137,7 @@ void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable ) m_bInteractionDone = false; // without session we assume UI is always possible, // so it was reqeusted and granted - m_bInteractionRequested = m_bInteractionGranted = m_pSession ? false : true; + m_bInteractionRequested = m_bInteractionGranted = !m_pSession; // answer the session manager even if no listeners available anymore DBG_ASSERT( ! aListeners.empty(), "saveRequested but no listeners !" ); @@ -346,25 +345,24 @@ void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerLi sal_Bool SAL_CALL VCLSession::cancelShutdown() throw( RuntimeException ) { - return m_pSession ? (sal_Bool)m_pSession->cancelShutdown() : sal_False; + return m_pSession && m_pSession->cancelShutdown(); } // service implementation OUString SAL_CALL vcl_session_getImplementationName() { - static OUString aImplementationName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.VCLSessionManagerClient" ) ); - return aImplementationName; + return OUString( "com.sun.star.frame.VCLSessionManagerClient" ); } Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames() { Sequence< OUString > aRet(1); - aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.SessionManagerClient")); + aRet[0] = "com.sun.star.frame.SessionManagerClient"; return aRet; } -css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css::uno::Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ ) +css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( SAL_UNUSED_PARAMETER const css::uno::Reference< XMultiServiceFactory > & ) { return static_cast< cppu::OWeakObject * >(new VCLSession); } commit 1cdb792368ed26d58828eead2848422e7dec4c7d Author: Stephan Bergmann <[email protected]> Date: Tue Jun 19 10:17:14 2012 +0200 Make VCLSession into a OneInstanceFactory ...so no need to hold the one instance as ImplSVData::xSMClient. Nor as VCLSession::pOneInstance, after changing SalSession::SetCallback to carry VCLSession* as user data. Change-Id: I3180d72035e3da7aa164a20309fbaeccecbb9b65 diff --git a/vcl/inc/salsession.hxx b/vcl/inc/salsession.hxx index c912565..89e9239 100644 --- a/vcl/inc/salsession.hxx +++ b/vcl/inc/salsession.hxx @@ -84,25 +84,27 @@ struct SalSessionQuitEvent : public SalSessionEvent {} }; -typedef void(*SessionProc)( SalSessionEvent *pEvent); +typedef void(*SessionProc)(void *pData, SalSessionEvent *pEvent); class VCL_PLUGIN_PUBLIC SalSession { SessionProc m_aProc; + void * m_pProcData; public: SalSession() : m_aProc( 0 ) {} virtual ~SalSession(); - void SetCallback( SessionProc aCallback ) + void SetCallback( SessionProc aCallback, void * pCallbackData ) { m_aProc = aCallback; + m_pProcData = pCallbackData; } void CallCallback( SalSessionEvent* pEvent ) { if( m_aProc ) - m_aProc( pEvent ); + m_aProc( m_pProcData, pEvent ); } // query the session manager for a user interaction slot diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 8aa5f87..e96979a 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -53,16 +53,9 @@ #include <boost/unordered_map.hpp> -namespace com { -namespace sun { -namespace star { -namespace lang { +namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; -} -namespace frame { - class XSessionManagerClient; -} -}}} +} } } } struct ImplTimerData; struct ImplFileImageCacheData; @@ -366,7 +359,6 @@ struct ImplSVData rtl::Reference< vcl::DisplayConnection > mxDisplayConnection; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxAccessBridge; - com::sun::star::uno::Reference< com::sun::star::frame::XSessionManagerClient > xSMClient; ::vcl::SettingsConfigItem* mpSettingsConfigItem; std::list< vcl::DeleteOnDeinitBase* >* mpDeinitDeleteList; boost::unordered_map< int, rtl::OUString >* mpPaperNames; diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index 25a8810..47a39d8 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -84,8 +84,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient bool m_bInteractionDone; bool m_bSaveDone; - static void SalSessionEventProc( SalSessionEvent* pEvent ); - static VCLSession* pOneInstance; + static void SalSessionEventProc( void* pData, SalSessionEvent* pEvent ); void callSaveRequested( bool bShutdown, bool bCancelable ); void callShutdownCancelled(); @@ -103,8 +102,6 @@ public: virtual sal_Bool SAL_CALL cancelShutdown() throw( RuntimeException ); }; -VCLSession* VCLSession::pOneInstance = NULL; - VCLSession::VCLSession() : cppu::WeakComponentImplHelper1< XSessionManagerClient >( m_aMutex ), m_bInteractionRequested( false ), @@ -112,17 +109,13 @@ VCLSession::VCLSession() m_bInteractionDone( false ), m_bSaveDone( false ) { - DBG_ASSERT( pOneInstance == 0, "One instance of VCLSession only !" ); - pOneInstance = this; m_pSession = ImplGetSVData()->mpDefInst->CreateSalSession(); if( m_pSession ) - m_pSession->SetCallback( SalSessionEventProc ); + m_pSession->SetCallback( SalSessionEventProc, this ); } VCLSession::~VCLSession() { - DBG_ASSERT( pOneInstance == this, "Another instance of VCLSession in destructor !" ); - pOneInstance = NULL; delete m_pSession; } @@ -230,27 +223,28 @@ void VCLSession::callQuit() Application::AcquireSolarMutex( nAcquireCount ); } -void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) +void VCLSession::SalSessionEventProc( void* pData, SalSessionEvent* pEvent ) { + VCLSession * pThis = static_cast< VCLSession * >( pData ); switch( pEvent->m_eType ) { case Interaction: { SalSessionInteractionEvent* pIEv = static_cast<SalSessionInteractionEvent*>(pEvent); - pOneInstance->callInteractionGranted( pIEv->m_bInteractionGranted ); + pThis->callInteractionGranted( pIEv->m_bInteractionGranted ); } break; case SaveRequest: { SalSessionSaveRequestEvent* pSEv = static_cast<SalSessionSaveRequestEvent*>(pEvent); - pOneInstance->callSaveRequested( pSEv->m_bShutdown, pSEv->m_bCancelable ); + pThis->callSaveRequested( pSEv->m_bShutdown, pSEv->m_bCancelable ); } break; case ShutdownCancel: - pOneInstance->callShutdownCancelled(); + pThis->callShutdownCancelled(); break; case Quit: - pOneInstance->callQuit(); + pThis->callQuit(); break; } } @@ -372,11 +366,7 @@ Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames() css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css::uno::Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/ ) { - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->xSMClient.is() ) - pSVData->xSMClient = new VCLSession(); - - return css::uno::Reference< XInterface >(pSVData->xSMClient, UNO_QUERY ); + return static_cast< cppu::OWeakObject * >(new VCLSession); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index b482431..2f0027d 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -95,7 +95,7 @@ extern "C" { Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory; if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) ) { - xFactory = ::cppu::createSingleFactory( + xFactory = ::cppu::createOneInstanceFactory( xMgr, vcl_session_getImplementationName(), vcl_session_createInstance, vcl_session_getSupportedServiceNames() ); } commit b11de026cb8eb520dc410fd974581e780ecbef92 Author: Stephan Bergmann <[email protected]> Date: Mon Jun 18 18:21:36 2012 +0200 Remove duplicate ImplGetAppSVData and GetAppSalData Change-Id: I8cb241898e22251656de4e080f1ae9bfe0359383 diff --git a/vcl/inc/aqua/saldata.hxx b/vcl/inc/aqua/saldata.hxx index 7339d5c..e9023be 100644 --- a/vcl/inc/aqua/saldata.hxx +++ b/vcl/inc/aqua/saldata.hxx @@ -129,7 +129,6 @@ public: inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; } inline SalData *GetSalData() { return ImplGetSVData()->mpSalData; } -inline SalData *GetAppSalData() { return ImplGetAppSVData()->mpSalData; } // --- Prototypes --- diff --git a/vcl/inc/ios/saldata.hxx b/vcl/inc/ios/saldata.hxx index a15d4e8..eca863a 100644 --- a/vcl/inc/ios/saldata.hxx +++ b/vcl/inc/ios/saldata.hxx @@ -113,7 +113,6 @@ public: inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; } inline SalData *GetSalData() { return ImplGetSVData()->mpSalData; } -inline SalData *GetAppSalData() { return ImplGetAppSVData()->mpSalData; } // --- Prototypes --- diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 1d951fd..8aa5f87 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -395,7 +395,6 @@ long ImplCallEvent( NotifyEvent& rEvt ); extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData; inline VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; } -inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); } VCL_PLUGIN_PUBLIC void ImplHideSplash(); bool ImplInitAccessBridge( sal_Bool bAllowCancel, sal_Bool &rCancelled ); diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index 8195001..ce3870e 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -149,7 +149,6 @@ public: inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = pData; } inline SalData* GetSalData() { return ImplGetSVData()->mpSalData; } -inline SalData* GetAppSalData() { return ImplGetAppSVData()->mpSalData; } // -------------- // - SalShlData - diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index f5f678b..b63d658 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -468,7 +468,7 @@ void DeInitSalData() void InitSalMain() { // remember data, copied from WinMain - SalData* pData = GetAppSalData(); + SalData* pData = GetSalData(); if ( pData ) // Im AppServer NULL { STARTUPINFO aSI; commit 76cc3cf62162432afe2a34502a950654e7c3a48c Author: Stephan Bergmann <[email protected]> Date: Mon Jun 18 17:29:44 2012 +0200 SessionManagerClient::open need not be exported Change-Id: I0284d8ae16861f7081547780e6b7de27bacaf467 diff --git a/vcl/inc/unx/sm.hxx b/vcl/inc/unx/sm.hxx index 0dfc463..d3cf9ab 100644 --- a/vcl/inc/unx/sm.hxx +++ b/vcl/inc/unx/sm.hxx @@ -64,7 +64,7 @@ class SessionManagerClient DECL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void* ); DECL_STATIC_LINK( SessionManagerClient, InteractionHdl, void* ); public: - static VCLPLUG_GEN_PUBLIC void open(); // needed by other plugins, so export + static void open(); // needed by other plugins, so export static void close(); static bool checkDocumentsSaved(); commit 4307b6a465cd97cc0a85260cc798542b50ed0f58 Author: Stephan Bergmann <[email protected]> Date: Mon Jun 18 17:26:46 2012 +0200 Properly detect and remove ".bin" at end Change-Id: I89b321d5103017aa01151bd813d5789e688b62dd diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index bb55adf..843e039 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -525,9 +525,8 @@ rtl::OUString SessionManagerClient::getExecName() osl_getExecutableFile( &aExec.pData ); osl_getSystemPathFromFileURL( aExec.pData, &aSysExec.pData ); - int nPos = aSysExec.indexOf( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".bin")) ); - if( nPos != -1 ) - aSysExec = aSysExec.copy( 0, nPos ); + if( aSysExec.endsWith(".bin") ) + aSysExec = aSysExec.copy( 0, aSysExec.getLength() - RTL_CONSTASCII_LENGTH(".bin") ); return aSysExec; } commit dcd7230e06134487663773fc2f45f6556f503b02 Author: Stephan Bergmann <[email protected]> Date: Mon Jun 18 17:21:20 2012 +0200 USE_SM_EXTENSION is always defined Change-Id: I70cde1991514dcc25e4bb8824812eb64c2e66edc diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 82fd4b1..bb55adf 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -52,8 +52,6 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> -#define USE_SM_EXTENSION - static IceSalSession* pOneInstance = NULL; SalSession* X11SalInstance::CreateSalSession() @@ -125,10 +123,8 @@ class ICEConnectionObserver static int nWakeupFiles[2]; static oslMutex ICEMutex; static oslThread ICEThread; -#ifdef USE_SM_EXTENSION static IceIOErrorHandler origIOErrorHandler; static IceErrorHandler origErrorHandler; -#endif public: static void activate(); @@ -149,7 +145,6 @@ oslMutex ICEConnectionObserver::ICEMutex = NULL; oslThread ICEConnectionObserver::ICEThread = NULL; int ICEConnectionObserver::nWakeupFiles[2] = { 0, 0 }; -#ifdef USE_SM_EXTENSION IceIOErrorHandler ICEConnectionObserver::origIOErrorHandler = NULL; IceErrorHandler ICEConnectionObserver::origErrorHandler = NULL; @@ -160,7 +155,6 @@ static void IgnoreIceErrors(IceConn, Bool, int, unsigned long, int, int, IcePoin static void IgnoreIceIOErrors(IceConn) { } -#endif // HACK bool SessionManagerClient::bDocSaveDone = false; @@ -334,7 +328,6 @@ void SessionManagerClient::SaveYourselfProc( " SmInteractStyleErrors: " << (interact_style == SmInteractStyleErrors) << " SmInteractStyleErrors: " << (interact_style == SmInteractStyleAny)); BuildSmPropertyList(); -#ifdef USE_SM_EXTENSION bDocSaveDone = false; /* #i49875# some session managers send a "die" message if the * saveDone does not come early enough for their convenience @@ -351,7 +344,6 @@ void SessionManagerClient::SaveYourselfProc( sal_uIntPtr nStateVal = shutdown ? 0xffffffff : 0x0; Application::PostUserEvent( STATIC_LINK( (void*)nStateVal, SessionManagerClient, SaveYourselfHdl ) ); SAL_INFO("vcl.sm", "waiting for save yourself event to be processed" ); -#endif } IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG ) @@ -426,7 +418,6 @@ void SessionManagerClient::open() { static SmcCallbacks aCallbacks; -#ifdef USE_SM_EXTENSION // this is the way Xt does it, so we can too if( ! aSmcConnection && getenv( "SESSION_MANAGER" ) ) { @@ -483,7 +474,6 @@ void SessionManagerClient::open() } else if( ! aSmcConnection ) SAL_INFO("vcl.sm", "no SESSION_MANAGER"); -#endif } const rtl::OString& SessionManagerClient::getSessionID() @@ -495,14 +485,12 @@ void SessionManagerClient::close() { if( aSmcConnection ) { -#ifdef USE_SM_EXTENSION ICEConnectionObserver::lock(); SAL_INFO("vcl.sm", "attempting SmcCloseConnection"); SmcCloseConnection( aSmcConnection, 0, NULL ); SAL_INFO("vcl.sm", "SmcConnection closed"); ICEConnectionObserver::unlock(); ICEConnectionObserver::deactivate(); -#endif aSmcConnection = NULL; } } @@ -583,7 +571,6 @@ void ICEConnectionObserver::activate() nWakeupFiles[0] = nWakeupFiles[1] = 0; ICEMutex = osl_createMutex(); bIsWatching = sal_True; -#ifdef USE_SM_EXTENSION /* * Default handlers call exit, we don't care that strongly if something * happens to fail @@ -591,7 +578,6 @@ void ICEConnectionObserver::activate() origIOErrorHandler = IceSetIOErrorHandler( IgnoreIceIOErrors ); origErrorHandler = IceSetErrorHandler( IgnoreIceErrors ); IceAddConnectionWatch( ICEWatchProc, NULL ); -#endif } } @@ -601,11 +587,9 @@ void ICEConnectionObserver::deactivate() { lock(); bIsWatching = sal_False; -#ifdef USE_SM_EXTENSION IceRemoveConnectionWatch( ICEWatchProc, NULL ); IceSetErrorHandler( origErrorHandler ); IceSetIOErrorHandler( origIOErrorHandler ); -#endif nConnections = 0; if( ICEThread ) { @@ -634,7 +618,6 @@ void ICEConnectionObserver::wakeup() void ICEConnectionWorker( void* ) { -#ifdef USE_SM_EXTENSION while( osl_scheduleThread(ICEConnectionObserver::ICEThread) && ICEConnectionObserver::nConnections ) { ICEConnectionObserver::lock(); @@ -678,7 +661,6 @@ void ICEConnectionWorker( void* ) } ICEConnectionObserver::unlock(); } -#endif SAL_INFO("vcl.sm", "shutting donw ICE dispatch thread"); } @@ -693,7 +675,6 @@ void ICEConnectionObserver::ICEWatchProc( // this implicitly means that a call into ICE lib is calling this // so the ICEMutex MUST already be locked by the caller -#ifdef USE_SM_EXTENSION if( opening ) { int fd = IceConnectionNumber( connection ); @@ -773,7 +754,6 @@ void ICEConnectionObserver::ICEWatchProc( } SAL_INFO( "vcl.sm", "ICE connection on " << IceConnectionNumber( connection ) << " " << (opening ? "inserted" : "removed")); SAL_INFO( "vcl.sm", "Display connection is " << ConnectionNumber( GetGenericData()->GetSalDisplay()->GetDisplay() ) ); -#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
