PDA

View Full Version : Strange crashing



Radek
4th June 2013, 15:39
I am trying to create a slightly updated version of the Blanchette - Summerfield "slider - spinbox" example. The updating consists in creating the GUI in the Designer and using the .ui file in my code. The main window is a class MyFrame with a default ctor:



MyFrame::MyFrame() : QMainWindow()
{
ui.setupUi(this);

connect(ui.slider,SIGNAL(valueChanged(int)),ui.spi nbox,SLOT(setValue(int)));
connect(ui.spinbox,SIGNAL(valueChanged(int)),ui.sl ider,SLOT(setValue(int)));

show();
}


The program compiles and runs nicely. When I click the 'x' button on the titlebar, the program closes gracefully sometimes (about 50 % chance) and sometimes produces a crash output:



*** glibc detected *** /home/radek/Desktop/C++/project/slider-release/slider: free(): invalid next size (fast): 0x00000000008a1f90 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x7f35be0d0d76]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f35be0d5aac]
/home/radek/Desktop/C++/project/slider-release/slider[0x403c57]
/home/radek/Desktop/C++/project/slider-release/slider[0x403a7d]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f35be078ead]
/home/radek/Desktop/C++/project/slider-release/slider[0x403ac5]


but then I get informed that



/home/radek/Desktop/C++/project/slider-release/slider exited with code 0


I cannot find out any rule, when the program exits normally and when it crashes. Any ideas?

ChrisW67
5th June 2013, 02:24
Line 8 is typically unnecessary because you call show() from outside the object (in main()).

What is main() doing? How are you creating/destroying a MyFrame instance?

Radek
5th June 2013, 05:45
Here is the project.