Results 1 to 3 of 3

Thread: Unable to access members of same class, giving seg fault

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Unable to access members of same class, giving seg fault

    No return statements in functions returning non-void:
    Qt Code:
    1. QWidget* ApplicationLog::createLogWindow()
    2. {
    3. m_pCmdLogHL = new QHBoxLayout(this);
    4. m_pLogTE = new QTextEdit(this);
    5. m_pCmdLogHL->addWidget(m_pLogTE);
    6. // return !
    7. }
    8.  
    9. QWidget* ApplicationLog::createFrameWindow()
    10. {
    11. m_pButtonsHL = new QHBoxLayout(this);
    12. m_pMinMaxBut = new Button(this,"Minimize");
    13. connect(m_pMinMaxBut,SIGNAL(clicked()),this,SLOT(logWindowMinMax()));
    14. m_bIsMaximize = 1;
    15. // return !
    16. }
    To copy to clipboard, switch view to plain text mode 

    Another thing, check if createLogWindow() is called before trying to access m_pLogTE object.
    Last edited by stampede; 25th October 2013 at 13:29. Reason: updated contents

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,323
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Unable to access members of same class, giving seg fault

    The OP's code won't even compile, much less execute, so obviously we are not seeing the whole story. As amleto says in every post:

    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. Replies: 2
    Last Post: 29th December 2011, 12:27
  2. Replies: 4
    Last Post: 17th January 2011, 14:05
  3. Replies: 1
    Last Post: 9th January 2011, 07:20
  4. Abstract base class and inherited class members
    By JovianGhost in forum General Programming
    Replies: 3
    Last Post: 19th March 2010, 12:32
  5. Replies: 4
    Last Post: 26th June 2007, 19:19

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
  •  
Qt is a trademark of The Qt Company.