Hi,

I have following class:
Qt Code:
  1. #ifndef NORMALSEARCHWIDGET_H
  2. #define NORMALSEARCHWIDGET_H
  3.  
  4. #include <QWidget>
  5. #include <QBoxLayout>
  6. class listBrowserWidget;
  7.  
  8. class normalSearchWidget : public QWidget
  9. {
  10. Q_OBJECT
  11. public:
  12. normalSearchWidget(QWidget *parent = 0);
  13. ~normalSearchWidget();
  14. public slots:
  15. void setLbTbDirection ( QBoxLayout::Direction direction );
  16. private:
  17. listBrowserWidget *lbw1;
  18. listBrowserWidget *lbw2;
  19. QBoxLayout *layout;
  20. };
  21. #endif
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include <QBoxLayout>
  2.  
  3. #include "normalsearchwidget.h"
  4. #include "listbrowserwidget.h"
  5.  
  6. normalSearchWidget::normalSearchWidget(QWidget *parent)
  7. : QWidget(parent)
  8. {
  9. layout = new QBoxLayout( QBoxLayout::TopToBottom );
  10. layout->setMargin( 0 );
  11. layout->setSpacing( 2 );
  12.  
  13. listBrowserWidget *lbw1 = new listBrowserWidget();
  14. listBrowserWidget *lbw2 = new listBrowserWidget();
  15.  
  16. layout->addWidget(lbw1);
  17. layout->addWidget(lbw2);
  18.  
  19. this->setLayout( layout );
  20.  
  21. // Next line works ( same line as in setLbTbDirection(QBoxLayout::Direction direction) )
  22. lbw1->setDirection( QBoxLayout::TopToBottom );
  23.  
  24. // with this line I get and segmentation fault!
  25. setLbTbDirection( QBoxLayout::TopToBottom );
  26. }
  27.  
  28. normalSearchWidget::~normalSearchWidget()
  29. {}
  30.  
  31. void normalSearchWidget::setLbTbDirection ( QBoxLayout::Direction direction )
  32. {
  33. lbw1->setDirection( QBoxLayout::TopToBottom );
  34. }
To copy to clipboard, switch view to plain text mode 

As discribed in the commentar, I don't anderstand, why a statement in the constructor works and in a lokal function it causes an segFault. The function itself, without the line, works also perfekt.
I yet have deleted all generatet files, and have recompiled my program, but the error is still there.

Thanks for help,
Lykurg