Hi,
I have completely rebuild my project but get still a segmentation fault. I don't understand why, because the "setText()" works in the constructor but not in the function? Here is the relevant code:
	
	#include <QWidget>
#include <QtGui>
 
class MyGraphicView 
: public QWidget  {
    Q_OBJECT
 
    public:
      MyGraphicView
(QWidget *parent 
= 0);
 
    private:
      void updateImageInformation();
 
  };
 
 
//////////////////////// CPP-File ////////////////////////
 
#include "MyGraphicView.h"
 
#include <QtGui>
 
MyGraphicView
::MyGraphicView(QWidget *parent
) :  {
    [...]
    info_filesize 
= new QLabel(this);
    [...]
    info_filesize->setText("KB"); // <- works!!!
  }
 
void MyGraphicView::updateImageInformation()
  {
    info_filesize->setText("----"); // <- SIGSEGV
  }
        #include <QWidget>
#include <QtGui>
class MyGraphicView : public QWidget
  {
    Q_OBJECT
    public:
      MyGraphicView(QWidget *parent = 0);
    private:
      void updateImageInformation();
      QLabel *info_filesize;
  };
//////////////////////// CPP-File ////////////////////////
#include "MyGraphicView.h"
#include <QtGui>
MyGraphicView::MyGraphicView(QWidget *parent) :
  QWidget(parent)
  {
    [...]
    info_filesize = new QLabel(this);
    [...]
    info_filesize->setText("KB"); // <- works!!!
  }
void MyGraphicView::updateImageInformation()
  {
    info_filesize->setText("----"); // <- SIGSEGV
  }
To copy to clipboard, switch view to plain text mode 
  and GDB says:
	
	(gdb) run
Starting program: /home/lykurg/workspace/cpp/workplace/ganesha/ganesha
[Thread debugging using libthread_db enabled]
[New Thread -1224829232 (LWP 9063)]
 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1224829232 (LWP 9063)]
QLabel::setText (this=0x2f006c, text
=@0xbf828400
) at widgets
/qlabel.
h:154 154     widgets/qlabel.h: No such file or directory.
        in widgets/qlabel.h
Current language:  auto; currently c++
        (gdb) run
Starting program: /home/lykurg/workspace/cpp/workplace/ganesha/ganesha
[Thread debugging using libthread_db enabled]
[New Thread -1224829232 (LWP 9063)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1224829232 (LWP 9063)]
QLabel::setText (this=0x2f006c, text=@0xbf828400) at widgets/qlabel.h:154
154     widgets/qlabel.h: No such file or directory.
        in widgets/qlabel.h
Current language:  auto; currently c++
To copy to clipboard, switch view to plain text mode 
  When I comment the "setText()" in updateImageInformation() out, the program starts and executes the constructor-setText without any problems.
Thanks,
Lykurg
				
			
Bookmarks