This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[PATCH] Crash when changing upload speed from tray menu

Tags: None
(comma "," separated)
imported4-HayArms
Registered Member
Posts
6
Karma
0
Hi ,

with Ktorrent 3.2.1 + QT 4.5 I was : experiencing a bug that makes ktorrent crash while changing the upload speed from the trayicon menu. This happens , strangely,only when the main window is visible and not when is hidden.

The crash is related to the function "QMenu::findIdForAction()" .

I haven't tracked down the source of the bug completely, but I believe that is somewhat related to updating the menu while managing the "triggered" event of the menu.
Code: Select all
   void SetMaxRate::onTriggered(QAction* act)
   {
      int rate;
      if(act == unlimited)
         rate=0;
      else
         rate=act->text().remove("&").toInt(); // remove ampersands

      if(type == UPLOAD)
      {
         Settings::setMaxUploadRate(rate);
         net::SocketMonitor::setUploadCap( Settings::maxUploadRate() * 1024);
      }
      else
      {
         Settings::setMaxDownloadRate(rate);
         net::SocketMonitor::setDownloadCap(Settings::maxDownloadRate()*1024);
      }
      Settings::self()->writeConfig();
               
                update(); //<--- THIS IS THE PROBLEM
   }


removing the update() solves the problem and doesn't seem to change functionality , because update is called when the "aboutToShow()" signal is triggered just before the showing of the menu.

I don't know why the crash does not happen with the Download rate menu, probably some event related to the Upload menu is triggered while the menu is being updated that is not triggered for the Download menu (just guessing).

I don't know if this bug is also present with precedent versions of QT (< 4.5)

Greetings
Marcello

PATCH:
Code: Select all
*** ktorrent/trayicon.cpp.orig   2009-05-04 15:11:48.955633794 +0200
--- ktorrent/trayicon.cpp   2009-05-04 15:12:01.305653694 +0200
*************** namespace kt
*** 361,367 ****
        }
        Settings::self()->writeConfig();
 
-       update();
     }
  }
 
--- 361,366 ----

George
Moderator
Posts
5421
Karma
1

Tue May 05, 2009 8:04 am
This is already fixed :

https://bugs.kde.org/show_bug.cgi?id=188447

The fix will be included in 3.2.2
imported4-HayArms
Registered Member
Posts
6
Karma
0

Tue May 05, 2009 2:01 pm
George wrote:This is already fixed :

https://bugs.kde.org/show_bug.cgi?id=188447

The fix will be included in 3.2.2


Good to hear that!

Bye!


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft