File: Hall-Of-Shame.txt

package info (click to toggle)
kwave 0.7.2-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,048 kB
  • ctags: 4,906
  • sloc: cpp: 31,275; ansic: 13,111; sh: 9,511; perl: 2,724; makefile: 786; asm: 145
file content (71 lines) | stat: -rw-r--r-- 2,877 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

This file contains the history of some bugs that were so nasty, ugly and 
difficult to find that they earned to be documented. Shall no one ever be
so unlucky to fall into one of these traps...

November 2001: the "QString.sprintf bug" (4 days)
	
	I used the following line to format a string:
	QString pt = pt.sprintf(",%f,%f", p->x, p->y);
	
	When I split it into two lines, it worked:
	QString pt;
	pt = pt.sprintf(",%f,%f", p->x, p->y);
	
	>> Symptoms: crashes somewhere later in the program, one
	             entry disappeared from the list of interpolations
	>> Conclusion: never use an uninitialized QString for any operation!

March 2001: the "clearNumberedMenu bug" (more than 2 weeks)

	In that version the "activated" signal of menu entries directly
	emitted signals that were evaluated in the main program. When 
	selecting a file from the submenu with the list of recent files, the
	following happened:
	- the menu entry emitted it's signal and called a slot in the
	  MenuNode class
	- the MenuNode class emitted the signal to the MenuManager, then
	  to the TopWidget where it was interpreted. Still in the stack
	  context of the slot of MenuNode
	- the main program loaded the file
	- the main program wiped the list of recent files and thus destroyed
	  the context of the MenuNode that emitted the signal
	- the call chain returned to the MenuNode and the menu node 
	  representation in Qt
	- sometimes the program survived it, but sometimes it crashed somewhere
	  after all actions of the main program seem to have completed.

	>> Symptoms: crashes after the program has completed it's foreground
	             actions, with stack traces that contain only functions
		     of X11, KDE and Qt but not even one single line of the
		     Kwave program
	>> Conclusion: be very careful that you don't delete an object
		       from it's own context and also think of calling chains
		       that cause the deletion from some other side !

May 2000: the "sprintf bug" (about 4 days)

	Somewhere at the start of the program there was a loop for reading
	in the list of recent files. The key was generated with sprintf into
	a buffer with 2 bytes. Guess what happens when the loop counter gets
	greater than 10:
	char buffer[2];
	for (i=0; i<20; i++) {
	    sprintf(buffer, "%d", i);
	    ...
	}

	>> Symptoms: crashes somewhere in libc, in unpredictable places
	>> Conclusion: never use a string function without "n" !

December 1999: the "delete *FILE bug" (about 3 days)

	Someone has first used QFile and created a QFile instance with new.
	After a while he found out that this doesn't work as expected and
	changed back to FILE*. He converted like this:
	new QFile input(name) -> FILE *input = fopen(name)
	delete input;         -> delete input;

	>> Symptoms: crashes somewhere in libc, normally in malloc
	>> Conclusion: never delete a FILE* pointer !