[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-multimedia
Subject: Re: [jan.smid@student.uni-magdeburg.de: Bug#28076: arts crashes when playing system sounds (windows
From: Jeff Tranter <tranter () pobox ! com>
Date: 2001-07-17 15:18:16
[Download RAW message or body]
Attached is a patch which displays repeated duplicate messages only once.
I also looked at using KUniqueApplication in artsmessage, but this looked
like a better solution. It it looks okay I will commit it.
On July 13, 2001 12:35 pm, you wrote:
> Hi!
>
> I think the fact that you can easily bring down your whole system with a
> message flood is definitely a show stopper for 2.2. Do you want to look at
> fixing this?
>
> My very very approximate idea how to do this is that we should somehow
> prevent another aRts message from being popped up unless the first is done,
> maybe some KUniqueApplication thing (like noatun does) would do the trick.
>
> It might also make sense to gather similar messages and display them like
>
> "some stupid error occured (22)"
>
> if the same message keeps on repeating again and again.
>
> Cu... Stefan
>
> -----Forwarded message from jan.smid@student.uni-magdeburg.de-----
>
> Received: from master.kde.org (max.tat.physik.uni-tuebingen.de
> [134.2.170.93]) by space.twc.de (8.8.7/8.8.7) with SMTP id JAA23020
> for <stefan@space.twc.de>; Wed, 4 Jul 2001 09:33:05 +0200
> Received: (qmail 14338 invoked by uid 1003); 4 Jul 2001 07:33:05 -0000
> Subject: Bug#28076: arts crashes when playing system sounds (windows open
> etc.) Reply-To: 28076@bugs.kde.org
> Resent-From: jan.smid@student.uni-magdeburg.de
> Resent-To: kde-bugs-dist@max.tat.physik.uni-tuebingen.de
> Resent-CC: Stefan Westerfeld <stefan@space.twc.de>
> Resent-Date: Wed, 04 Jul 2001 07:33:04 GMT
> Resent-Message-ID: <handler.28076.B.99423168513830@bugs.kde.org>
> Resent-Sender: coolo@kde.org
> X-KDE-PR-Message: report 28076
> X-KDE-PR-Package: arts
> X-Loop: owner@bugs.kde.org
> Received: via spool by bugs@bugs.kde.org id=B.99423168513830
> (code B ref -1); Wed, 04 Jul 2001 07:33:04 GMT
> Date: 4 Jul 2001 07:26:57 -0000
> Message-ID: <20010704072657.13827.qmail@master.kde.org>
> To: submit@bugs.kde.org
> From: jan.smid@student.uni-magdeburg.de
>
> Package: arts
> Version: KDE 2.2.0 Beta1
> Severity: normal
> Installed from: SuSE RPMs
> Compiler: Not Specified
> OS: Linux
> OS/Compiler notes: Suse 7.0, XF 4.0.3, PIII
>
> When I select the acqua style, arts displays the following message: "can't
> open /home/test/.kde2/apps/share/sounds: file format not supported/"
> artsmessage repeats this until the I have to exit X, because of swapping.
>
> (Submitted via bugs.kde.org)
>
> -----End of forwarded message-----
["message.patch" (text/x-diff)]
Index: debug.cc
===================================================================
RCS file: /home/kde/kdelibs/arts/mcop/debug.cc,v
retrieving revision 1.5
diff -u -r1.5 debug.cc
--- debug.cc 2001/03/20 12:53:30 1.5
+++ debug.cc 2001/07/17 14:55:07
@@ -39,8 +39,8 @@
* always sent to standard error because they tend to be very verbose.
* Note that the external application is run in the background to
* avoid blocking the sound server.
-*/
-void display_message(Debug::Level level, const char *msg) {
+ */
+void output_message(Debug::Level level, const char *msg) {
char buff[1024];
/* default to text output if no message app is defined or if it is a debug message. */
@@ -64,6 +64,38 @@
break; // avoid compile warning
}
system(buff);
+}
+
+/*
+ * Display a message using output_message. If the message is the same
+ * as the previous one, just increment a count but don't display
+ * it. This prevents flooding the user with duplicate warnings. If the
+ * message is not the same as the previous one, then we report the
+ * previously repeated message (if any) and reset the last message and
+ * count.
+ */
+void display_message(Debug::Level level, const char *msg) {
+ static char lastMsg[1024];
+ static Debug::Level lastLevel;
+ static int msgCount = 0;
+
+ if (!strncmp(msg, lastMsg, 1024))
+ {
+ msgCount++;
+ return;
+ } else {
+ if (msgCount > 0)
+ {
+ char buff[1024];
+ sprintf(buff, "%s\n(The previous message was repeated %d times.)", lastMsg, msgCount);
+ output_message(lastLevel, buff);
+ }
+ strncpy(lastMsg, msg, 1024);
+ lastLevel = level;
+ msgCount = 0;
+ }
+
+ output_message(level, msg);
}
static class DebugInitFromEnv {
_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic