Results 1 to 18 of 18

Thread: Previous frame inner to this frame(corrupt stack?)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Previous frame inner to this frame(corrupt stack?)

    I am building a c/s system,but now I am runing into the trouble as title.
    when client process receive a message from server process,it show a modeless dialog,and when user click close button, it hide the dialog.

    at first everything is ok,and then the client process is crashed. gdb shows
    the error as title.


    below is my way how to realize this.


    class ApplicationWindow:: public QMainWindow
    {
    ....
    protected:

    CControlDlg m_controlDlg; //inherit from QDialog,and I pass this to it as it's parent window in ApplicationWindow's Construct function
    }


    display the dialog:
    ApplicationWindow::showControlDlg()
    {
    m_control.show()
    }

    hide the dialog:

    CControlDlg::closeEvent(QCloseEvent* e)
    {
    this->hide();
    }

    thanks anyone who can give me some idea!

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Where actually you have crash?
    In calling hide() method?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Quote Originally Posted by zlatko
    Where actually you have crash?
    In calling hide() method?

    In calling show() method.

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Hm then show ApplicationWindow's Construct function
    a life without programming is like an empty bottle

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Qt Code:
    1. CControlDlg::closeEvent(QCloseEvent* e)
    2. {
    3. this->hide();
    4. }
    To copy to clipboard, switch view to plain text mode 

    Won't it make an infinite loop?

  6. #6
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Quote Originally Posted by wysota
    Qt Code:
    1. CControlDlg::closeEvent(QCloseEvent* e)
    2. {
    3. this->hide();
    4. }
    To copy to clipboard, switch view to plain text mode 

    Won't it make an infinite loop?
    it will not,i tested as below:
    CControlDlg::closeEvent(QCloseEvent* e)
    {
    Q_ASSERT(FALSE),
    this->hide();
    }

    Q_ASSERT(FALSE) only execute once.

  7. #7
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Previous frame inner to this frame(corrupt stack?)

    ...,m_controlExecDlg(this) what is this? You try init your dialog as app window

    Try next code
    Qt Code:
    1. class ApplicationWindow:: public QMainWindow
    2. {
    3. ....
    4. protected:
    5. CControlDlg *m_controlDlg; //inherit from QDialog,and I pass this to it as it's parent window in ApplicationWindow's Construct function
    6. }
    7.  
    8. ApplicationWindow::ApplicationWindow(): QMainWindow( 0, "HMI", estructiveClose|Qt::WStyle_Customize)
    9. {
    10. m_controlDlg = new CControlDlg(this);
    11. }
    To copy to clipboard, switch view to plain text mode 
    a life without programming is like an empty bottle

  8. The following user says thank you to zlatko for this useful post:

    coralbird (28th April 2006)

  9. #8
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Unhappy Re: Previous frame inner to this frame(corrupt stack?)

    Quote Originally Posted by zlatko
    ...,m_controlExecDlg(this) what is this? You try init your dialog as app window

    Try next code
    Qt Code:
    1. class ApplicationWindow:: public QMainWindow
    2. {
    3. ....
    4. protected:
    5. CControlDlg *m_controlDlg; //inherit from QDialog,and I pass this to it as it's parent window in ApplicationWindow's Construct function
    6. }
    7.  
    8. ApplicationWindow::ApplicationWindow(): QMainWindow( 0, "HMI", estructiveClose|Qt::WStyle_Customize)
    9. {
    10. m_controlDlg = new CControlDlg(this);
    11. }
    To copy to clipboard, switch view to plain text mode 
    It still does not work.
    Last edited by coralbird; 28th April 2006 at 10:06.

  10. #9
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Previous frame inner to this frame(corrupt stack?)

    by the way,I pass ApplicationWindow's pointer to a QThread object, and in QThread::run() calls ApplicationWindow::ShowControlDlg().

  11. #10
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Previous frame inner to this frame(corrupt stack?)

    and what is the result?
    a life without programming is like an empty bottle

  12. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Previous frame inner to this frame(corrupt stack?)

    1. Try to clean your object code (make clean) and build it again.
    2. Don't access GUI functions from within threads. It's forbidden

  13. #12
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Quote Originally Posted by wysota
    1. Try to clean your object code (make clean) and build it again.
    2. Don't access GUI functions from within threads. It's forbidden
    even hide() and show()?I can do it in MFC.

  14. #13
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Quote Originally Posted by zlatko
    and what is the result?


    result is can show dialog successful serval times .

  15. #14
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Previous frame inner to this frame(corrupt stack?)

    Quote Originally Posted by zlatko
    Hm then show ApplicationWindow's Construct function
    ApplicationWindow::ApplicationWindow()
    : QMainWindow( 0, "HMI", estructiveClose|Qt::WStyle_Customize) ,m_controlExecDlg(this)

Similar Threads

  1. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2007, 01:35
  2. Replies: 16
    Last Post: 7th March 2006, 15:57

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.