[arch-commits] Commit in kdelibs/trunk (PKGBUILD refcount.patch)
Pierre Schmitz
pierre at archlinux.org
Fri Aug 1 02:00:55 UTC 2008
Date: Thursday, July 31, 2008 @ 22:00:54
Author: pierre
Revision: 7408
upgpkg: kdelibs 4.1.0-4
fix closing of apps
Added:
kdelibs/trunk/refcount.patch
Modified:
kdelibs/trunk/PKGBUILD
----------------+
PKGBUILD | 15 ++++++---
refcount.patch | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+), 4 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2008-08-01 01:02:39 UTC (rev 7407)
+++ PKGBUILD 2008-08-01 02:00:54 UTC (rev 7408)
@@ -3,7 +3,7 @@
pkgname=kdelibs
pkgver=4.1.0
-pkgrel=3
+pkgrel=4
pkgdesc="KDE Core Libraries"
arch=('i686' 'x86_64')
url='http://www.kde.org'
@@ -15,12 +15,19 @@
makedepends=('pkgconfig' 'cmake' 'automoc4' 'intltool' 'avahi' 'libgl')
replaces=('arts')
options=('docs')
-source=("ftp://ftp.archlinux.org/other/kde/${pkgname}-${pkgver}.tar.bz2" 'kde-applications-menu.patch')
-md5sums=('a72fd8653b86f73860d0e7ebf0f2d606' '3daa0f01fe26325fb3dbd807a04898ad')
+source=("ftp://ftp.archlinux.org/other/kde/${pkgname}-${pkgver}.tar.bz2"
+ 'kde-applications-menu.patch'
+ 'refcount.patch')
+md5sums=('a72fd8653b86f73860d0e7ebf0f2d606'
+ '3daa0f01fe26325fb3dbd807a04898ad'
+ '754015620274dfce933d8691f8686f84')
build() {
cd $srcdir/${pkgname}-${pkgver}
- patch -p1 -i $srcdir/kde-applications-menu.patch
+ # avoid file conflict with gnome-menu
+ patch -p1 -i $srcdir/kde-applications-menu.patch || return 1
+ # fix closing of apps; see http://bugs.kde.org/show_bug.cgi?id=167826
+ patch -p1 -i $srcdir/refcount.patch || return 1
cd ..
mkdir build
cd build
Added: refcount.patch
===================================================================
--- refcount.patch (rev 0)
+++ refcount.patch 2008-08-01 02:00:54 UTC (rev 7408)
@@ -0,0 +1,90 @@
+Index: kdelibs/kdeui/widgets/kmainwindow.cpp
+===================================================================
+--- kdelibs/kdeui/widgets/kmainwindow.cpp (Revision 840376)
++++ kdelibs/kdeui/widgets/kmainwindow.cpp (Revision 840379)
+@@ -226,6 +226,11 @@
+ {
+ KGlobal::ref();
+
++ // We set allow quit to true, so when the refcounting reaches 0 the application instance will
++ // be exited. This has a similar purpose than setQuitOnLastWindowClosed (from
++ // QApplication), but it honors (de)refing from KGlobal.
++ KGlobal::setAllowQuit(true);
++
+ q = _q;
+
+ q->setAnimated(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects);
+Index: kdelibs/kdecore/kernel/kglobal.cpp
+===================================================================
+--- kdelibs/kdecore/kernel/kglobal.cpp (Revision 840376)
++++ kdelibs/kdecore/kernel/kglobal.cpp (Revision 840379)
+@@ -251,11 +251,14 @@
+
+ /**
+ * This counter indicates when to quit the application.
+- * It starts at 1, is decremented in KMainWindow when the last window is closed, but
+- * is incremented by operations that should outlive the last window closed
+- * (e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client).
++ * It starts at 0, is incremented by KMainWindow, systray icons, running jobs, etc.
++ * and decremented again when those things are destroyed.
++ * This mechanism allows dialogs and jobs to outlive the last window closed
++ * e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client,
++ * the job progress widget with "keep open" checked, etc.
+ */
+-static int s_refCount = 1;
++static int s_refCount = 0;
++static bool s_allowQuit = false;
+
+ void KGlobal::ref()
+ {
+@@ -267,9 +270,14 @@
+ {
+ --s_refCount;
+ //kDebug() << "KGlobal::deref() : refCount = " << s_refCount;
+- if (s_refCount <= 0) {
++ if (s_refCount <= 0 && s_allowQuit) {
+ QCoreApplication::instance()->quit();
+ }
+ }
+
++void KGlobal::setAllowQuit(bool allowQuit)
++{
++ s_allowQuit = allowQuit;
++}
++
+ #undef PRIVATE_DATA
+Index: kdelibs/kdecore/kernel/kglobal.h
+===================================================================
+--- kdelibs/kdecore/kernel/kglobal.h (Revision 840376)
++++ kdelibs/kdecore/kernel/kglobal.h (Revision 840379)
+@@ -409,6 +409,16 @@
+ * "last window closed" event, but some events should outlive the last window closed
+ * (e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client).
+ *
++ * We have some use cases that we want to take care of (the format is "action refcount"):
++ * - open window -> setAllowQuit(true) 1 ; close window 0 => EXIT
++ * - job start 1; job end 0 [don't exit yet]; open window -> setAllowQuit(true) 1 ; close window 0 => EXIT
++ * - job start 1; open window -> setAllowQuit(true) 2; close window 1; job end 0 => EXIT
++ * - job start 1; open window -> setAllowQuit(true) 2; job end 1; close window 0 => EXIT
++ * - open dialog 0; close dialog 0; => DO NOT EXIT
++ * - job start 1; job end 0; create two main objects 2; delete both main objects 0 => EXIT
++ * - open window -> setAllowQuit(true) 1; add systray icon 2; close window 1 => DO NOT EXIT
++ * - open window -> setAllowQuit(true) 1; add systray icon 2; remove systray icon 1; close window 0 => EXIT
++ *
+ * Note that for this to happen you must call qApp->setQuitOnLastWindowClosed(false),
+ * in main() for instance.
+ */
+@@ -421,6 +431,13 @@
+ KDECORE_EXPORT void deref();
+
+ /**
++ * If refcounting reaches 0 (or less), and @p allowQuit is true, the instance of the application
++ * will automatically be exited. Otherwise, the application will not exit automatically.
++ * @since 4.2
++ */
++ KDECORE_EXPORT void setAllowQuit(bool allowQuit);
++
++ /**
+ * The component currently active (useful in a multi-component
+ * application, such as a KParts application).
+ * Don't use this - it's mainly for KAboutDialog and KBugReport.
More information about the arch-commits
mailing list