Results 1 to 4 of 4

Thread: segmentation fault

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default segmentation fault

    I keep getting segmentation fault and file not opened error ? Can anyone help ?


    Qt Code:
    1. int HistoricalInfo::Load(const QString & strFilename)
    2. {
    3. QFile file(strFilename); //IODevice
    4.  
    5. reader.setDevice(&file);
    6.  
    7. h_strFilename = strFilename; //save the file name
    8.  
    9. if (!file.open(IO_ReadOnly | IO_Translate))
    10. {
    11. errno = ENOENT;
    12. return 0;
    13. }
    14. else
    15. {
    16. printf("File opened successfully \n");
    17. }
    18. if (g_pMainWindow != NULL && g_pMainWindow->m_pLblStatus != NULL)
    19. g_pMainWindow->m_pLblStatus->setText("Loading Historical Info...");
    20.  
    21. g_pMainWindow->m_pPlayback = new QPlayback(g_pMainWindow->tabsContainer, "playback");
    22.  
    23. g_pMainWindow->tabsWidget->addTab(g_pMainWindow->m_pPlayback, QString("Playback"));
    24.  
    25. g_pMainWindow->m_pPlayback->SetPlaybackInitialized(true);
    26.  
    27. return 1;
    28. }
    29.  
    30. void HistoricalInfo::HistoricData_Read(QTextStream & reader)
    31. {
    32. QString line;
    33.  
    34. while (!(line = reader.readLine()).isNull())
    35. {
    36. if (line.isEmpty())
    37. continue; //skip the next if, go to while
    38. if(line == "*")
    39. {
    40. break;
    41. }
    42. if(!Extractinfo(line, recSpeed))
    43. printf("error occured while extracting historical data\n");
    44. }
    45.  
    46. LoadHistoricalinfo(); //load segement data into a list
    47.  
    48. }
    49.  
    50. void QPlayback:: signalPlay()
    51. {
    52.  
    53. g_pMainWindow->m_pHist->HistoricData_Read(g_pMainWindow->m_pHist->reader); ///**************
    54. ptrModelV->paintEvent(e); //refresh map
    55. printf("PAINTING \n");
    56. }
    To copy to clipboard, switch view to plain text mode 

    ***************this is where I get the segmentation fault. Is there anything obviously wrong with the code ?
    Last edited by jpn; 30th July 2008 at 08:18. Reason: missing [code] tags

Similar Threads

  1. QTreeWidgetItem - segmentation fault
    By szczav in forum Qt Programming
    Replies: 1
    Last Post: 4th June 2007, 22:54
  2. Process aborted. Segmentation fault
    By Pragya in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2007, 08:12
  3. Replies: 2
    Last Post: 19th May 2007, 18:25
  4. Segmentation fault running any QT4 executables
    By jellis in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2007, 16:35
  5. Icons missing => segmentation fault
    By antonio.r.tome in forum Qt Programming
    Replies: 4
    Last Post: 8th March 2006, 16:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.