[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/shortcuts
From:       Michael Jansen <kde () michael-jansen ! biz>
Date:       2008-10-01 19:37:50
Message-ID: 1222889870.401155.3226.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 866736 by mjansen:

Fix those kdedglobalaccel crashes. It's not safe to assume the config file
has a correct content. Somehow it get's messed up sometimes and contains
something like this:

  next=Meta+B,Meta+B,
  nextTrack=Meta+B,Meta+B,

BUG:171870
CCBUG:171206

 M  +10 -2     kdedglobalaccel.cpp  


--- trunk/KDE/kdelibs/kdeui/shortcuts/kdedglobalaccel.cpp #866735:866736
@@ -394,8 +394,9 @@
 
 void KdedGlobalAccel::unRegister(const QStringList &actionId)
 {
+    kDebug(125) << actionId;
+
     Q_ASSERT(actionId.size()==4);
-
     if (actionId.size() < 4) {
         return;
     }
@@ -661,7 +662,14 @@
 
             foreach (int key, ad->keys) {
                 if (key != 0) {
-                    d->keyToAction.insert(key, ad);
+                    if (d->keyToAction.contains(key)) {
+                        // The shortcut is already used. The config file is
+                        // broken. Ignore the request.
+                        ad->keys.removeAll(key);
+                        kWarning() << "Shortcut found twice in kglobalshortcutsrc.";
+                    } else {
+                        d->keyToAction.insert(key, ad);
+                    }
                 }
             }
         }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic