LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Search this Thread
Old 12-08-2007, 09:31 PM   #1
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 441

Rep: Reputation: 30
qt segmentation fault

Well, I can't be sure it's not my own files, but would one of you experts take a look at this code and see if there is cause for a segmentation fault. I have tried tracing it do the cerr statements but the fault seems to occur on the return of the call to down(QListViewItem* lvi, const QPoint& p, int col).
#include "FileView.h"
#include <iostream>

  lv = new QListView(this);
  lv->addColumn( "File" );
  lv->addColumn( "Owner" ); 
  lv->addColumn( "Group" );
  lv->addColumn( "Permissions" ); 

  bup = new QPushButton("Up", this);
  connect(bup, SIGNAL(clicked()), this, SLOT(up()) );
  connect(lv, SIGNAL(doubleClicked( QListViewItem*, const QPoint &, int)), this, SLOT(down(QListViewItem*, const QPoint &, int)) );

void QFileView::resizeEvent(QResizeEvent* re)
  lv->move(0, bup->height() );
  lv->resize(re->size().width(), re->size().height() - bup->height() );

void QFileView::populate()
  while( fi.nextFile())
    if ( !fi.isHidden() )
      new QListViewItem( lv, fi.getName().c_str(), fi.getOwner().c_str(), fi.getGroup().c_str(), fi.getPermissions().c_str() );

void QFileView::up()

void QFileView::down(QListViewItem* lvi, const QPoint& p, int col)
Old 12-09-2007, 02:12 AM   #2
Senior Member
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
With a seg fault the easiest way to work out what is going on is to use a debugger and generate a stack trace. If you use KDevelop then GDB is integrated into it and you can quickly see where the problem is.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is a segmentation fault? 144419855310001 Fedora 1 04-28-2006 08:39 AM
yast segmentation fault, system freezing - nvidia driver at fault? BaltikaTroika Suse/Novell 2 12-02-2005 10:34 AM
Help !!! Segmentation fault mola Linux - Software 3 06-23-2005 12:13 PM
Segmentation fault tejas15_10 Programming 9 06-20-2005 10:12 AM
Segmentation fault tejas15_10 Linux - Newbie 1 06-14-2005 05:44 AM

All times are GMT -5. The time now is 06:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration