KMuddy

Welcome! ( Recent posts | Mark all | Login | Register ) » KMuddy Discussion Forums » KMuddy » Bug Reports » Segfault Crash at 10 hour con...

Pages: << prev 1 next >>
Segfault Crash at 10 hour connection time + fix, Bug report and patch
 
This member is currently offline Jovan
New Member


Avatar

Member Level

Group: Members
Posts: 1
Joined: Jan 13, 2008

Go to the bottom of the page Go to the top of the page
Posted Jan 13, 2008, 10:35 pm   

This patch fixes a segmentation fault I've been getting every time I've been connected for 10 hours straight:

Code:
diff -U 3 -H -b -w -B -E -d -r -N -- kmuddy-0.8/lib/cstatus.cpp kmuddy-0.8/lib/cstatus.cpp
--- kmuddy-0.8/lib/cstatus.cpp  2005-10-19 01:01:52.000000000 -0700
+++ kmuddy-0.8/lib/cstatus.cpp  2008-01-13 21:22:33.000000000 -0800
@@ -16,6 +16,9 @@
  *                                                                         *
  ***************************************************************************/

+//Sets the size of the status buffer which controls time displayer
+#define status_size 30
+
 #include "cstatus.h"

 #include <qdatetime.h>
@@ -37,8 +40,8 @@

   sb->insertItem (" " + i18n ("Off-line") + " ", ID_CONNECTED, 0, true);
   sb->insertItem (" ??x?? ", ID_DIMENSION, 0, true);
-  sb->insertItem (" 0:00:00 ", ID_TIMER, 0, true);
-  sb->insertItem (" " + i18n ("idle") + " 0:00 ", ID_IDLE, 0, true);
+  sb->insertItem (" 00D:00H:00M:00S ", ID_TIMER, 0, true);
+  sb->insertItem (" " + i18n ("idle") + " 00D:00H:00M:00S ", ID_IDLE, 0, true);
   sb->insertItem ("", ID_VARIABLES);
   sb->insertItem ("", ID_PARTIAL);
   timerShown = true;
@@ -116,7 +119,7 @@
   if (!timerShown)
   {
     timerReset ();
-    sb->changeItem (" 0:00:00 ", ID_TIMER);
+    sb->changeItem (" 00D:00H:00M:00S ", ID_TIMER);
   }
   timerShown = true;
 }
@@ -138,7 +141,7 @@

 void cStatus::dimensionsChanged (int x, int y)
 {
-  char s1[10];
+  char s1[status_size];
   QString s2;
   sprintf (s1, " %dx%d ", x, y);
   s2 = s1;
@@ -166,8 +169,8 @@
   conntime = 0;
   idletime1 = 0;
   if (timerShown)
-    sb->changeItem (" 0:00:00 ", ID_TIMER);
-  sb->changeItem (" " + i18n ("idle") + " 0:00", ID_IDLE);
+     sb->changeItem (" 00D:00H:00M:00S ", ID_TIMER);
+  sb->changeItem (" " + i18n ("idle") + " 00D:00H:00M:00S", ID_IDLE);
   timer1->start (1000);
 }

@@ -175,7 +178,7 @@
 {
   sb->changeItem (" " + i18n ("Connected") + " ", ID_CONNECTED);
   sb->changeItem ("", ID_PARTIAL);
-  sb->changeItem (" " + i18n ("idle") + " 0:00 ", ID_IDLE);
+  sb->changeItem (" " + i18n ("idle") + " 00D:00H:00M:00S ", ID_IDLE);
   showMessage (i18n ("Connected."));
 }

@@ -209,18 +212,19 @@
     idletime1 = 0;
     timer1->stop ();
     timer1->start (1000);
-    sb->changeItem (" " + i18n ("idle") + " 0:00 ", ID_IDLE);
+    sb->changeItem (" " + i18n ("idle") + " 00D:00H:00M:00S ", ID_IDLE);
   }
 }

 const QString cStatus::connTimeString ()
 {
-  char s1[10];
-  int h = conntime / 3600;
+  char s1[status_size];
+  int d = conntime / (3600*24);
+  int h = (conntime / 3600) % 24;
   int s = conntime % 3600;
   int m = s / 60;
   s = s % 60;
-  sprintf (s1, " %d:%02d:%02d ", h, m, s);
+  sprintf (s1, " %02dD:%02dH:%02dM:%02dS ", d, h, m, s);
   QString s2 = s1;
   return s2;
 }
@@ -246,16 +250,14 @@
 {
   ++idletime1;

-  int h, m, s;
+  int d, h, m, s;
   s = idletime1 % 60;
   m = ((idletime1 - s) / 60) % 60;
-  h = (idletime1 - s) / 3600;
+  h = ((idletime1 - s) / 3600) % 24;
+  d = (idletime1 - s)  / (3600 * 24);

-  char ss[15];
-  if (h > 0)
-    sprintf (ss, " %d:%02d:%02d ", h, m, s);
-  else
-    sprintf (ss, " %d:%02d ", m, s);
+  char ss[status_size];
+  sprintf (ss, " %02dD:%02dH:%02dM:%02dS ", d, h, m, s);

   sb->changeItem (" " + i18n ("idle") + ss, ID_IDLE);
 }


Thank you for the great client, and hope this helps.

This member is currently offline Mecir
KMuddy Author


Member Level

Group: Administrators
Posts: 1,576
Joined: Feb 2, 2003

Go to the bottom of the page Go to the top of the page
Posted Jan 14, 2008, 1:41 am   

It definitely will, thanks !
.........................
/ Tomas

This member is currently offline Tanktalus
New Member


Member Level

Group: Members
Posts: 6
Joined: Oct 29, 2007

Go to the bottom of the page Go to the top of the page
Posted Jan 16, 2008, 7:22 pm   

Wow.  I had just started looking into this annoyance myself, got a stack trace (wasn't as useful as I'd hoped), then I see this.  Thanks a bunch.  :->

This member is currently offline pengue
Full Member


Avatar

Member Level

Group: Members
Posts: 60
Joined: Mar 6, 2008

Go to the bottom of the page Go to the top of the page
Posted Mar 8, 2008, 12:12 am   Last edited Mar 8, 2008, 12:13 am by mdtcmc

Despite having little to offer this thread, I was actually very pleased to read that I am not the only person who stays on for extended periods. To that, my friend, I applaud you.
.........................
Intel Pentium E2220 Dual Core 2x2.4GHz 800MHz 1Mb|ABIT IP35 Pro XE|GeFORCE 8600GTS 512MB|6GB 1600 DDR2 Ballistix|2 x 500GB Seagate SATA|Running Gentoo GNU/Linux 2.6.25
http://img255.imageshack.us/img255/2783/gentoobadgevv0.png

Pages:<< prev 1 next >>
Valid XHTML 1.1! Valid CSS!

Feb 9, 2010, 3:19 am