Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Segfault core dumped
Forum Updated to NodeBB v4.3 + New Features

Segfault core dumped

Scheduled Pinned Locked Moved Solved C++ Gurus
segmentationsegfault
3 Posts 2 Posters 2.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qjay
    wrote on 10 Apr 2018, 06:04 last edited by
    #1

    Hello , i need help with a segfault error in this program .

    line 56: 5252 Segmentation fault (core dumped)

    Program is here : https://ghostbin.com/paste/j453x

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 10 Apr 2018, 06:34 last edited by
      #2

      This is not a Qt problem at all.

      Anyway, the bug is in line 61 in = &inFile; - you assign a variable created on a stack to variable in. In the next line, the inFile goes out of scope and is deleted. So when you try to access in later in the code, it segfaults.

      (Z(:^

      Q 1 Reply Last reply 10 Apr 2018, 06:43
      4
      • S sierdzio
        10 Apr 2018, 06:34

        This is not a Qt problem at all.

        Anyway, the bug is in line 61 in = &inFile; - you assign a variable created on a stack to variable in. In the next line, the inFile goes out of scope and is deleted. So when you try to access in later in the code, it segfaults.

        Q Offline
        Q Offline
        Qjay
        wrote on 10 Apr 2018, 06:43 last edited by
        #3

        @sierdzio said in Segfault core dumped:

        Anyway, the bug is in line 61 in = &inFile; - you assign a variable created on a stack to variable in. In the next line, the inFile goes out of scope and is deleted. So when you try to access in later in the code, it segfaults.

        Thanks !! . I know it's not Qt problem but that's why i posted it in C++ section

        1 Reply Last reply
        0

        1/3

        10 Apr 2018, 06:04

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved