From 9cda2841742b30bc5c0203591f955bf255d4d9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pertti=20Kellom=C3=A4ki?= Date: Tue, 14 Jun 2011 13:22:41 +0300 Subject: [PATCH] Fixes: NB#257654 - QApplication::applicationDirPath() and QApplication::applicationFilePath() return wrong values for d-boosted applications Details: Set application attribute Qt::AA_LinuxReinitPathsFromArgv0 so that QCoreApplication::applicationFilePath() and QCoreApplication::applicationDirPath() work correctly for d-boosted applications. RevBy: Alexey Shilov --- debian/changelog | 1 + src/qdeclarativebooster/CMakeLists.txt | 3 +++ src/qdeclarativebooster/mdeclarativecache.cpp | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index 27dc2ce..317137c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ applauncherd (0.30.1) unstable; urgency=low + * Fixes: NB#257654 - QApplication::applicationDirPath() and QApplication::applicationFilePath() return wrong values for d-boosted applications * Changes: New functional tests added to check testability library is loaded by booster-m and booster-d * Changes: Deprecate MDeclarativeCache::applicationDirPath() and MDeclarativeCache::applicationFilePath(). * Changes: Modify test applications to use _exit(). diff --git a/src/qdeclarativebooster/CMakeLists.txt b/src/qdeclarativebooster/CMakeLists.txt index d5ecc9b..4f28a59 100644 --- a/src/qdeclarativebooster/CMakeLists.txt +++ b/src/qdeclarativebooster/CMakeLists.txt @@ -21,6 +21,9 @@ set(LIBSRC mdeclarativecache.cpp mdeclarativecache.h mdeclarativecache_p.h) add_library(mdeclarativecache SHARED ${LIBSRC}) set_target_properties(mdeclarativecache PROPERTIES VERSION 0.1 SOVERSION 0) +if ($ENV{HARMATTAN}) + set_target_properties(mdeclarativecache PROPERTIES COMPILE_FLAGS -DHAVE_PATH_REINIT) +endif ($ENV{HARMATTAN}) target_link_libraries(mdeclarativecache ${LIBDL} ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES}) add_library(qdeclarativebooster MODULE ${PLUGINSRC} ${MOC_SRC}) diff --git a/src/qdeclarativebooster/mdeclarativecache.cpp b/src/qdeclarativebooster/mdeclarativecache.cpp index 79d01b2..3a63df5 100644 --- a/src/qdeclarativebooster/mdeclarativecache.cpp +++ b/src/qdeclarativebooster/mdeclarativecache.cpp @@ -182,6 +182,11 @@ QApplication* MDeclarativeCachePrivate::qApplication(int &argc, char **argv) __gcov_flush(); #endif +#ifdef HAVE_PATH_REINIT + // Set the magic attribute so that paths are reinitialized + qApplicationInstance->setAttribute(Qt::AA_LinuxReinitPathsFromArgv0, true); +#endif + return qApplicationInstance; }