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:

Qt Code:
  1. MyFrame::MyFrame() : QMainWindow()
  2. {
  3. ui.setupUi(this);
  4.  
  5. connect(ui.slider,SIGNAL(valueChanged(int)),ui.spinbox,SLOT(setValue(int)));
  6. connect(ui.spinbox,SIGNAL(valueChanged(int)),ui.slider,SLOT(setValue(int)));
  7.  
  8. show();
  9. }
To copy to clipboard, switch view to plain text mode 

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:

Qt Code:
  1. *** glibc detected *** /home/radek/Desktop/C++/project/slider-release/slider: free(): invalid next size (fast): 0x00000000008a1f90 ***
  2. ======= Backtrace: =========
  3. /lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x7f35be0d0d76]
  4. /lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f35be0d5aac]
  5. /home/radek/Desktop/C++/project/slider-release/slider[0x403c57]
  6. /home/radek/Desktop/C++/project/slider-release/slider[0x403a7d]
  7. /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f35be078ead]
  8. /home/radek/Desktop/C++/project/slider-release/slider[0x403ac5]
To copy to clipboard, switch view to plain text mode 

but then I get informed that

Qt Code:
  1. /home/radek/Desktop/C++/project/slider-release/slider exited with code 0
To copy to clipboard, switch view to plain text mode 

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