You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, April 11th 2012, 1:58pm

Bug in QFileDialogPrivate::_q_createDirectory()

//The following are the 3 files which I am using..
//Just to create a browse window

//Segmentation fault occurs if you

// 1) Create a 'new folder' (files should be in sorted in reverse (Z to A - details view))
// 2) Immediately open that new folder (see that the newfolder will not open, instead the folder just below newfolder will open.)
// 3) click 'up' or 'back' button and return to the previous folder (where newfolder is created)
// 4) Click on 'cancel'
// 5) Application closes and SegmentationFault occurs

// Problem is there in the QFileDialogPrivate::_q_createDirectory() function.
// Everything works fine if the file list in the browse window is sorted in ascending order (A to Z)

//main.cpp
#include <QApplication>
#include "window.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Window window;
window.show();
return app.exec();
}

//window.cpp
#include <QtGui>
#include "window.h"
Window::Window()
{
QFileDialog dialog(this);
dialog.setAcceptMode(QFileDialog::AcceptSave);
dialog.setWindowTitle("Select Configuration File Directory");
if(dialog.exec()==QDialog::Accepted)
{

}
}

//window.h
#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QComboBox;
class QLineEdit;
QT_END_NAMESPACE
class Window : public QWidget
{
Q_OBJECT
public:
Window();
public slots:
private:
};
#endif

2

Wednesday, April 11th 2012, 3:57pm

remove the dialog stuff from Widnow ctor. Add a button to your Window, and make the button call a slot that does your qfiledialog stuff.

I'm not sure if starting an event loop before the app event loop has started is valid qt.

Does it make any difference?



e:
just tried your code (well, I used QWidget instead of QMainWindow).

worked fine on win7 64, using Qt 4.6
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.

This post has been edited 2 times, last edit by "Amleto" (Apr 11th 2012, 4:43pm)


Similar threads

Used tags

Bug in 4.5.2