[Libreoffice-commits] .: Branch 'libreoffice-3-3' - 2 commits - desktop/source sfx2/source
Michael Meeks
mmeeks at kemper.freedesktop.org
Fri Nov 26 07:33:08 PST 2010
desktop/source/migration/migration.cxx | 33 ++++++++++++++++++++++------
desktop/source/migration/migration_impl.hxx | 5 ++--
sfx2/source/appl/shutdownicon.cxx | 26 +++++++++++++++++-----
3 files changed, 50 insertions(+), 14 deletions(-)
New commits:
commit 6e077925721c5d8e78f7eee2e09ed68647a03652
Author: Michael Meeks <michael.meeks at novell.com>
Date: Thu Nov 25 16:30:04 2010 +0000
disable multiple migrations via MIGRATED stamp file
If we fail to auto-migrate, this can cause lots of pain - since people
are unaware of where the migration occurs from. Thus - before we start
migrating, we create a 'MIGRATED' stamp file in the source of that, and
if this is present next migration, we simply don't migrate - fixed for
Mechtilde.
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 2c1d6d6..e66d126 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -85,6 +85,7 @@ static const ::rtl::OUString ITEM_DESCRIPTOR_LABEL(RTL_CONSTASCII_USTRINGPARAM("
static const ::rtl::OUString MENU_SEPERATOR(RTL_CONSTASCII_USTRINGPARAM(" | "));
static const ::rtl::OUString MENU_SUBMENU(RTL_CONSTASCII_USTRINGPARAM("..."));
+static const ::rtl::OUString MIGRATION_STAMP_NAME(RTL_CONSTASCII_USTRINGPARAM("/MIGRATED"));
::rtl::OUString retrieveLabelFromCommand(const ::rtl::OUString& sCommand, const ::rtl::OUString& sModuleIdentifier)
{
@@ -194,15 +195,31 @@ static const ::rtl::OUString MENU_SUBMENU(RTL_CONSTASCII_USTRINGPARAM("..."));
return sIdentifier;
}
-sal_Bool MigrationImpl::initializeMigration()
+bool MigrationImpl::alreadyMigrated()
{
- sal_Bool bRet = sal_False;
+ rtl::OUString aStr = m_aInfo.userdata + MIGRATION_STAMP_NAME;
+ File aFile(aStr);
+ // create migration stamp, and/or check its existence
+ bool bRet = aFile.open (osl_File_OpenFlag_Write | osl_File_OpenFlag_Create | osl_File_OpenFlag_NoLock) == FileBase::E_EXIST;
+ OSL_TRACE( "File '%s' exists? %d\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr(),
+ bRet );
+ return bRet;
+}
+
+bool MigrationImpl::initializeMigration()
+{
+ bool bRet = false;
if (!checkMigrationCompleted()) {
readAvailableMigrations(m_vMigrationsAvailable);
sal_Int32 nIndex = findPreferedMigrationProcess(m_vMigrationsAvailable);
- if ( nIndex >= 0 )
+ // m_aInfo is now set to the preferred migration source
+ if ( nIndex >= 0 ) {
+ if (alreadyMigrated())
+ return false;
m_vrMigrations = readMigrationSteps(m_vMigrationsAvailable[nIndex].name);
+ }
bRet = m_aInfo.userdata.getLength() > 0;
}
@@ -358,7 +375,7 @@ void MigrationImpl::setMigrationCompleted()
}
}
-sal_Bool MigrationImpl::checkMigrationCompleted()
+bool MigrationImpl::checkMigrationCompleted()
{
sal_Bool bMigrationCompleted = sal_False;
try {
@@ -367,15 +384,17 @@ sal_Bool MigrationImpl::checkMigrationCompleted()
aPropertySet->getPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("MigrationCompleted"))) >>= bMigrationCompleted;
- static const char* pEnv = getenv("SAL_DISABLE_USERMIGRATION" );
- if( !bMigrationCompleted && pEnv != NULL )
+ if( !bMigrationCompleted && getenv("SAL_DISABLE_USERMIGRATION" ) )
{
// migration prevented - fake it's success
setMigrationCompleted();
+ bMigrationCompleted = sal_True;
}
} catch (Exception&) {
// just return false...
}
+ OSL_TRACE( "Migration %s", bMigrationCompleted ? "already completed" : "not done" );
+
return bMigrationCompleted;
}
@@ -1210,7 +1229,7 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat
for (; i<nCount; ++i)
{
::rtl::OUString sCmd;
- uno::Sequence< beans::PropertyValue > aTempPropSeq;
+ uno::Sequence< beans::PropertyValue > aTempPropSeq;
xTemp->getByIndex(i) >>= aTempPropSeq;
for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j)
{
diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx
index 835194f..d66caba 100644
--- a/desktop/source/migration/migration_impl.hxx
+++ b/desktop/source/migration/migration_impl.hxx
@@ -207,6 +207,7 @@ private:
// functions to control the migration process
bool readAvailableMigrations(migrations_available&);
+ bool alreadyMigrated();
migrations_vr readMigrationSteps(const ::rtl::OUString& rMigrationName);
sal_Int32 findPreferedMigrationProcess(const migrations_available&);
install_info findInstallation(const strings_v& rVersions);
@@ -235,12 +236,12 @@ private:
void refresh();
void setMigrationCompleted();
- sal_Bool checkMigrationCompleted();
+ bool checkMigrationCompleted();
public:
MigrationImpl(const NS_UNO::Reference< NS_CSS::lang::XMultiServiceFactory >&);
~MigrationImpl();
- sal_Bool initializeMigration();
+ bool initializeMigration();
sal_Bool doMigration();
rtl::OUString getOldVersionName();
};
commit 448d3cfe248fe733dfcb1d857f016db7780d90a9
Author: Michael Meeks <michael.meeks at novell.com>
Date: Thu Nov 25 16:25:55 2010 +0000
fix crash in exiting via disabling lone quick-starter, terminate at idle
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index e495843..26ec5c9 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -182,6 +182,9 @@ bool ShutdownIcon::LoadModule( osl::Module **pModule,
return true;
}
+// These two timeouts are necessary to avoid there being
+// plugin frames still on the stack, after unloading that
+// code, causing a crash during disabling / termination.
class IdleUnloader : Timer
{
::osl::Module *m_pModule;
@@ -199,6 +202,22 @@ public:
}
};
+class IdleTerminate : Timer
+{
+ Reference< XDesktop > m_xDesktop;
+public:
+ IdleTerminate (Reference< XDesktop > xDesktop)
+ {
+ m_xDesktop = xDesktop;
+ Start();
+ }
+ virtual void Timeout()
+ {
+ m_xDesktop->terminate();
+ delete this;
+ }
+};
+
void ShutdownIcon::initSystray()
{
if (m_bInitialized)
@@ -576,11 +595,8 @@ void ShutdownIcon::terminateDesktop()
if ( xSupplier.is() )
{
Reference< XIndexAccess > xTasks ( xSupplier->getFrames(), UNO_QUERY );
- if( xTasks.is() )
- {
- if( xTasks->getCount() < 1 )
- xDesktop->terminate();
- }
+ if( xTasks.is() && xTasks->getCount() < 1 )
+ new IdleTerminate( xDesktop );
}
// remove the instance pointer
More information about the Libreoffice-commits
mailing list