[Libreoffice-commits] .: 2 commits - desktop/inc desktop/source desktop/win32
Stephan Bergmann
sbergmann at kemper.freedesktop.org
Thu Jun 7 02:05:45 PDT 2012
desktop/inc/app.hxx | 2
desktop/source/app/app.cxx | 145 ++++++++++-----------
desktop/win32/source/officeloader/officeloader.cxx | 3
3 files changed, 78 insertions(+), 72 deletions(-)
New commits:
commit 55836370ffb70a34b888f81cdacdfede8fee29cf
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jun 7 10:58:38 2012 +0200
fdo#43989: Revert "win32-dont-attempt-restart.diff: Don't attempt to restart OOo after crash"
This reverts commit f8e1d2438199c4a76ceeb36352678c415e25272c, which erroneously
disabled automatic restart on Windows completely and has now been addressed in a
better way with 150bf2c95c193b30e050ac1c54d64b5485af088d "bnc#524250: Show
backing component after cancelled recovery."
diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx
index 92a7c38..14c2303 100644
--- a/desktop/win32/source/officeloader/officeloader.cxx
+++ b/desktop/win32/source/officeloader/officeloader.cxx
@@ -419,7 +419,8 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
CloseHandle( aProcessInfo.hProcess );
CloseHandle( aProcessInfo.hThread );
}
- } while ( false );
+ } while ( fSuccess
+ && ( ::desktop::ExitHelper::E_CRASH_WITH_RESTART == dwExitCode || ::desktop::ExitHelper::E_NORMAL_RESTART == dwExitCode ));
delete[] lpCommandLine;
return fSuccess ? dwExitCode : -1;
commit b5ad981518f4407243f89507b2561dd0b1ef28ee
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jun 7 10:50:18 2012 +0200
bnc#524250: Show backing component after cancelled recovery
...instead of an empty Writer document, which is non-intuitive when the user had
worked on something other than a Writer document before the crash.
f8e1d2438199c4a76ceeb36352678c415e25272c "win32-dont-attempt-restart.diff: Don't
attempt to restart OOo after crash" had previously attempted to fix this with a
sledgehammer approach of not restarting at all after a crash on Windows, under
the wrong assumption that there would be no restart after crash at all on Linux
either (which was apparently rather a bug caused by the newly introduced
oosplash at that time).
Change-Id: If65d2e21640d56262c486d887c4a29137cabcd0a
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 0dfa7ca..ea107e8 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -191,6 +191,8 @@ class Desktop : public Application
/// does initializations which are necessary for the first run of the office
void DoFirstRunInitializations();
+ static void ShowBackingComponent(Desktop * progress);
+
static sal_Bool SaveTasks();
static void retrieveCrashReporterState();
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 7374ea3..7ddec0e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1203,24 +1203,19 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave ,
css::util::URL aURL;
if (bEmergencySave)
aURL.Complete = COMMAND_EMERGENCYSAVE;
+ else if (bExistsRecoveryData)
+ aURL.Complete = COMMAND_RECOVERY;
+ else if (bCrashed && Desktop::isCrashReporterEnabled() )
+ aURL.Complete = COMMAND_CRASHREPORT;
else
- {
- if (bExistsRecoveryData)
- aURL.Complete = COMMAND_RECOVERY;
- else
- if (bCrashed && Desktop::isCrashReporterEnabled() )
- aURL.Complete = COMMAND_CRASHREPORT;
- }
+ return false;
- sal_Bool bRet = sal_False;
- if ( !aURL.Complete.isEmpty() )
- {
- xURLParser->parseStrict(aURL);
+ xURLParser->parseStrict(aURL);
- css::uno::Any aRet = xRecoveryUI->dispatchWithReturnValue(aURL, css::uno::Sequence< css::beans::PropertyValue >());
- aRet >>= bRet;
- }
- return bRet;
+ css::uno::Any aRet = xRecoveryUI->dispatchWithReturnValue(aURL, css::uno::Sequence< css::beans::PropertyValue >());
+ sal_Bool bRet = sal_False;
+ aRet >>= bRet;
+ return !bEmergencySave || bRet;
}
/*
@@ -1674,40 +1669,8 @@ int Desktop::Main()
(!Application::AnyInput( VCL_INPUT_APPEVENT ) ))
{
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
- Reference< XFrame > xDesktopFrame( xDesktop, UNO_QUERY );
- if (xDesktopFrame.is())
- {
- SetSplashScreenProgress(60);
- Reference< XFrame > xBackingFrame;
- Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
-
- xBackingFrame = xDesktopFrame->findFrame(OUString( "_blank" ), 0);
- if (xBackingFrame.is())
- xContainerWindow = xBackingFrame->getContainerWindow();
- if (xContainerWindow.is())
- {
- SetDocumentExtendedStyle(xContainerWindow);
- SetSplashScreenProgress(75);
- Sequence< Any > lArgs(1);
- lArgs[0] <<= xContainerWindow;
-
- Reference< XController > xBackingComp(
- xSMgr->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), UNO_QUERY);
- if (xBackingComp.is())
- {
- Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
- // Attention: You MUST(!) call setComponent() before you call attachFrame().
- // Because the backing component set the property "IsBackingMode" of the frame
- // to true inside attachFrame(). But setComponent() reset this state everytimes ...
- xBackingFrame->setComponent(xBackingWin, xBackingComp);
- SetSplashScreenProgress(100);
- xBackingComp->attachFrame(xBackingFrame);
- CloseSplashScreen();
- xContainerWindow->setVisible(sal_True);
- }
- }
- }
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
+ ShowBackingComponent(this);
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
}
}
}
@@ -2355,7 +2318,7 @@ void Desktop::OpenClients()
// check if a document has been recovered - if there is one of if a document was loaded by cmdline, no default document
// should be created
Reference < XComponent > xFirst;
- sal_Bool bLoaded = sal_False;
+ bool bRecovery = false;
const CommandLineArgs& rArgs = GetCommandLineArgs();
SvtInternalOptions aInternalOptions;
@@ -2482,7 +2445,6 @@ void Desktop::OpenClients()
impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData);
if ( !getenv ("OOO_DISABLE_RECOVERY") &&
- ( ! bLoaded ) &&
(
( bExistsRecoveryData ) || // => crash with files => recovery
( bCrashed ) // => crash without files => error report
@@ -2491,22 +2453,10 @@ void Desktop::OpenClients()
{
try
{
- impl_callRecoveryUI(
+ bRecovery = impl_callRecoveryUI(
sal_False , // false => force recovery instead of emergency save
bCrashed ,
bExistsRecoveryData);
- /* TODO we cant be shure, that at least one document could be recovered here successfully
- So we set bLoaded=sal_True to supress opening of the default document.
- But we should make it more safe. Otherwhise we have an office without an UI ...
- ...
- May be we can check the desktop if some documents are existing there.
- */
- Reference< XFramesSupplier > xTasksSupplier(
- ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.frame.Desktop") ),
- ::com::sun::star::uno::UNO_QUERY_THROW );
- Reference< XElementAccess > xList( xTasksSupplier->getFrames(), UNO_QUERY_THROW );
- if ( xList->hasElements() )
- bLoaded = sal_True;
}
catch(const css::uno::Exception& e)
{
@@ -2538,16 +2488,13 @@ void Desktop::OpenClients()
OSL_FAIL(OUStringToOString(aMessage, RTL_TEXTENCODING_ASCII_US).getStr());
}
- if (
- ( ! bLoaded ) &&
- ( bExistsSessionData )
- )
+ if ( bExistsSessionData )
{
// session management
try
{
Reference< XSessionManagerListener > r(xSessionListener, UNO_QUERY_THROW);
- bLoaded = r->doRestore();
+ r->doRestore();
}
catch(const com::sun::star::uno::Exception& e)
{
@@ -2585,8 +2532,6 @@ void Desktop::OpenClients()
( !aRequest.aPrintToList.empty() && !aRequest.aPrinterName.isEmpty() ) ||
!aRequest.aConversionList.empty() )
{
- bLoaded = sal_True;
-
if ( rArgs.HasModuleParam() )
{
SvtModuleOptions aOpt;
@@ -2635,6 +2580,12 @@ void Desktop::OpenClients()
if ( rArgs.IsQuickstart() || rArgs.IsInvisible() || Application::AnyInput( VCL_INPUT_APPEVENT ) )
// soffice was started as tray icon ...
return;
+
+ if ( bRecovery )
+ {
+ ShowBackingComponent(0);
+ }
+ else
{
OpenDefault();
}
@@ -3014,6 +2965,58 @@ void Desktop::DoFirstRunInitializations()
}
}
+void Desktop::ShowBackingComponent(Desktop * progress)
+{
+ Reference< XMultiServiceFactory > xSMgr(
+ comphelper::getProcessServiceFactory(), UNO_SET_THROW);
+ Reference< XFrame > xDesktopFrame(
+ xSMgr->createInstance("com.sun.star.frame.Desktop"), UNO_QUERY);
+ if (xDesktopFrame.is())
+ {
+ if (progress != 0)
+ {
+ progress->SetSplashScreenProgress(60);
+ }
+ Reference< XFrame > xBackingFrame;
+ Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
+
+ xBackingFrame = xDesktopFrame->findFrame(OUString( "_blank" ), 0);
+ if (xBackingFrame.is())
+ xContainerWindow = xBackingFrame->getContainerWindow();
+ if (xContainerWindow.is())
+ {
+ SetDocumentExtendedStyle(xContainerWindow);
+ if (progress != 0)
+ {
+ progress->SetSplashScreenProgress(75);
+ }
+ Sequence< Any > lArgs(1);
+ lArgs[0] <<= xContainerWindow;
+
+ Reference< XController > xBackingComp(
+ xSMgr->createInstanceWithArguments(OUString( "com.sun.star.frame.StartModule" ), lArgs), UNO_QUERY);
+ if (xBackingComp.is())
+ {
+ Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
+ // Attention: You MUST(!) call setComponent() before you call attachFrame().
+ // Because the backing component set the property "IsBackingMode" of the frame
+ // to true inside attachFrame(). But setComponent() reset this state everytimes ...
+ xBackingFrame->setComponent(xBackingWin, xBackingComp);
+ if (progress != 0)
+ {
+ progress->SetSplashScreenProgress(100);
+ }
+ xBackingComp->attachFrame(xBackingFrame);
+ if (progress != 0)
+ {
+ progress->CloseSplashScreen();
+ }
+ xContainerWindow->setVisible(sal_True);
+ }
+ }
+ }
+}
+
// ========================================================================
void Desktop::CheckFirstRun( )
{
More information about the Libreoffice-commits
mailing list