this little project should demonstrate a bug(??) when using 
member-objects in a qt-application with signal/slots.
mostly it causes a segmentation fault. but even when not, the 
memory-handling is not correct. valgind reports a memory leak
from different numbers of mallocs and frees.   

point of interest is the following object :
struct msgVbuf {
    long type;
    char data[BUFSIZ];
}
defined in SysVMsgSendThread.h
you can define it as class too and alloc the data dynamically
with new-operator in constructor and delete it in destructor.
behavior is the same. 

all works fine without usage of signal/slots, as shown in the 
CON-version (i removed all qt-stuff but you can add QDir or
QString and it will work too).
but it crashes in the GUI-version with signal/slot-mechanism.
when clicking the button (and moving the mouse outside).
and the only difference is the small main.cpp.

----------

make main_Console.txt or main_GUI.txt to current main.cpp 
(or any *.cpp) and compile this version the bug-demo program
by calling ./build.

i tested it with Qt 4.3.0 :
  libc6 	v2.5.0
  libglib2.0	v2.12.11
  libstdc++6	v4.1.2
  libgcc1	v1:4.1.2
and with Qt 4.3.2 :
  libc6 	v2.6.1
  libglib2.0	v2.14.0
  libstdc++6	v4.2.1
  libgcc1	v1:4.2.1
and with Qt 4.2.3.

with Qt 4.3.2 the segmentation fault occurs delayed when mouse
was moved inside widget (after click) and instantly when mouse 
leaves widget area. with Qt 4.3.0/4.2.3 it crashes always 
promptly. 

i also checked it with g++/gcc versions 4.2.1, 4.1.2 and 3.3.5.
no differences.


i have no idea what the problem is. is it an error of me ?
or is it a bug in the qt-stuff ? how can i avoid or bypass
it ? any comments highly appreciated.


best regards
Obel

(ObeliX-@gmx.de)