Results 1 to 3 of 3

Thread: Multiple window / form application. QFileDialog crashes

  1. #1
    Join Date
    Sep 2010
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Multiple window / form application. QFileDialog crashes

    Dear all,

    I am writing a GUI application for image processing. I have three windows (please see attached image):
    1. Main GUI.
    2. Window for displaying 2D image
    3. Window to draw a simple graph
    All windows were drawn using Qt Creator 2.0.0 based on Qt 4.7.0 (32bit).

    Currently, I am creating windows 2 and 3 inside Main GUI by using new and delete commands.
    However, I have a problem: the program crashes sometimes (randomly) when I try to open file using
    QFileDialog newdialog(this);
    newdialog.setReadOnly(true);
    QString path = newdialog.getOpenFileName(this, tr("Open File"), filename);
    It is not reproducible, sometimes it crashes on third time of usage, sometimes on fifths. Thus, I cant not understand what is wrong.

    Could anybody suggest what is the right way to handle multiple windows/forms?

    Thank you for your help,
    Roman
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Multiple window / form application. QFileDialog crashes

    The right way to handle this is a debugger.
    Run your code in a debugger and look at the backtrace to see where the crash happened

  3. The following user says thank you to tbscope for this useful post:

    ramzes13 (21st September 2010)

  4. #3
    Join Date
    Sep 2010
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple window / form application. QFileDialog crashes

    Quote Originally Posted by tbscope View Post
    The right way to handle this is a debugger.
    Run your code in a debugger and look at the backtrace to see where the crash happened
    Hi tbscope,
    Thank you for your comment. Even so I was using debugger I did not backtrace the reason carefully. Just now I looked at it once more and found that I was trying to delete non allocated memory in the destructor of my data class:
    if(input_2d_array) for(int i=0;i<size_x;i++) delete [] input_2d_array[i]; // size_x can be sometimes bigger than the actual size of input_2d_array[i]

    Thanks again.
    I will test it further and come back if there will be crashes again.

Similar Threads

  1. QFileDialog select multiple directories
    By bepaald in forum Newbie
    Replies: 4
    Last Post: 15th May 2012, 05:17
  2. Select multiple files from QFileDialog
    By jiveaxe in forum Qt Programming
    Replies: 6
    Last Post: 16th February 2009, 14:57
  3. Multiple form management?
    By kpmsivachand in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2009, 06:40
  4. QFileDialog QGLWidget crashes
    By SenSej in forum Newbie
    Replies: 1
    Last Post: 17th October 2008, 17:06
  5. QFileDialog Crashes with Networked Drive
    By Rayven in forum Qt Programming
    Replies: 6
    Last Post: 20th February 2008, 02:01

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.