Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 141062 - Remove lock file use in kde-misc/komics
Summary: Remove lock file use in kde-misc/komics
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-19 10:31 UTC by Tomas Cohen Arazi
Modified: 2006-07-19 10:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
No lock file usage patch (komics-1.4-nolockfile.patch,2.18 KB, patch)
2006-07-19 10:31 UTC, Tomas Cohen Arazi
Details | Diff
No lock file usage patch (komics-1.4-nolockfile.patch,2.89 KB, patch)
2006-07-19 10:48 UTC, Tomas Cohen Arazi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Cohen Arazi 2006-07-19 10:31:02 UTC
Komics is a KUniqueApplication so it does not need a lock file to prevent the user from opening a new instance of it.

When the app closes in a abd way (for example due to an X crash) it doesn't delete the lock file and tells the user to manually delete it instead of checking if the pid that owns the lock is already running.
Trying to correct that I found that Komics was a KUniqueApplication and thus didn't need the lock file. It needed a few changes to work. I made those changes reading the KDE api. If the changes don't work for you let me know.
Comment 1 Tomas Cohen Arazi 2006-07-19 10:31:48 UTC
Created attachment 92223 [details, diff]
No lock file usage patch
Comment 2 Tomas Cohen Arazi 2006-07-19 10:37:55 UTC
Comment on attachment 92223 [details, diff]
No lock file usage patch

>--- komics/src/main.cpp.orig	2004-10-10 13:54:07.000000000 -0300
>+++ komics/src/main.cpp	2006-07-19 14:12:37.000000000 -0300
>@@ -23,19 +23,22 @@
>                        I18N_NOOP(__comment), KAboutData::License_GPL_V2,
>                        "(C) 2003 Natella Roberto", 0, "roberto.natella@virgilio.it" );
> 
>-    about.addAuthor("Roberto Natella", 0,
>-                    "roberto.natella@virgilio.it", "http://www.orson.it/" );
>+	about.addAuthor("Roberto Natella", 0,
>+					"roberto.natella@virgilio.it", "http://www.orson.it/" );
> 
>-    KCmdLineArgs::init( argc, argv, &about);
>+	KCmdLineArgs::init( argc, argv, &about);
> 
>-    KApplication::disableAutoDcopRegistration();
>+	KApplication::disableAutoDcopRegistration();
>+
>+	if (!KUniqueApplication::start()) {
>+		fprintf(stderr, i18n( QString("Unable to start the application. Another instance was already started.") ));
>+		exit(0);
>+	}
>     KUniqueApplication app;
> 
>-    if( !Komics::lock() )
>-        return -1;
> 
>     Komics * komics = new Komics(0,new KConfig("libkomicsrc"));
>-    
>+
>     if( komics == NULL )
>         return -1;
> 
>@@ -46,8 +49,6 @@
>     int ret = app.exec();
>     delete komics;
> 
>-    Komics::unlock();
>-
>     return ret;
> }
> 
>--- komics/src/komics.cpp.orig	2004-10-10 17:14:19.000000000 -0300
>+++ komics/src/komics.cpp	2006-07-19 14:12:17.000000000 -0300
>@@ -1314,7 +1314,7 @@
>     
>     return url;
> }
>-
>+/*
> bool Komics::lock()
> {
>     QString lock = locateLocal("data", "komics/lock");
>@@ -1344,11 +1344,10 @@
> 
>     return true;
> }
>-
>+*/
> void Komics::shutDown()
> {
>     writeHistory();
>-    unlock();
> }
> 
> KomicsApplet::KomicsApplet(const QString& configFile, Type type, int actions, QWidget *parent, const char *name)
>@@ -1394,17 +1393,17 @@
> {
>     KPanelApplet* init( QWidget *parent, const QString configFile )
>     {
>-
>+/*
>         if(!Komics::lock())
>         {
>             return 0;
>         }
>         else
>-        {
>+        {*/
>             KGlobal::locale()->insertCatalogue("Komics");
>             return new KomicsApplet(configFile, KPanelApplet::Normal,
>                                     KPanelApplet::About | KPanelApplet::Preferences,
>                                     parent, "Komics");
>-        }
>+/*        }*/
>     }
> }
Comment 3 Tomas Cohen Arazi 2006-07-19 10:48:26 UTC
Created attachment 92224 [details, diff]
No lock file usage patch

I sen't a wrong diff file. I'm sorry.
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-07-19 10:51:33 UTC
This problem has to be reported upstream, as this is not a Gentoo issue by itself. Please also consider for your future contributions to avoid changing stylistic bits when patching (indentation) as that makes the patch bigger and changes harder to evaluate.
Comment 5 Tomas Cohen Arazi 2006-07-19 10:52:51 UTC
(In reply to comment #4)
> This problem has to be reported upstream, as this is not a Gentoo issue by
> itself. Please also consider for your future contributions to avoid changing
> stylistic bits when patching (indentation) as that makes the patch bigger and
> changes harder to evaluate.
> 

ack