SIGSEGV after adding QFileDialog::getOpenFileName to the program



  • Hi All,

    I'm writing a program that does some processing on a file. After I add this line to the application I get segmentation faults. The fault is not immediately after clicking the button, but it comes after a few minutes. How can I solve this?

    fileName = QFileDialog::getOpenFileName(this,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)");
    

    Versions:

    Windows 7 Enterprise SP1 64 bit
    Qt creator 4.1.0 Based on Qt 5.7.0 (MSVC 2013, 32 bit)
    Qt 5.8.0 MinGW 5.3.0 32 bit 
    

    Full program:

    #define EDIT_MARKER "This file was edited by 3803829-DXF-Text-Resizer"
    
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    #include <QFileDialog>
    #include <QDebug>
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        QString fileName;
        fileName = QFileDialog::getOpenFileName(this,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)");
    }
    


  • Backtrace:

    Thread 109 (Thread 7136.0x134c):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 108 (Thread 7136.0x1d7c):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 55 (Thread 7136.0x184):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 51 (Thread 7136.0x2e8):
    #0  0x7703c8f6 in ole32!BindMoniker () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #1  0x77045c30 in ole32!StgOpenStorage () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #2  0x77045c11 in ole32!StgOpenStorage () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #3  0x77045c6f in ole32!StgOpenStorage () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #4  0x77078ed2 in ole32!SetErrorInfo () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #5  0x77078e13 in ole32!SetErrorInfo () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #6  0x7706b9eb in ole32!PropVariantCopy () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #7  0x77078838 in ole32!SetErrorInfo () from C:\WINDOWS\syswow64\ole32.dll
    No symbol table info available.
    #8  0x556c314a in ?? () from C:\WINDOWS\SysWOW64\networkitemfactory.dll
    No symbol table info available.
    #9  0x775d43c0 in SHLWAPI!IUnknown_QueryService () from C:\WINDOWS\syswow64\shlwapi.dll
    No symbol table info available.
    #10 0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #11 0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #12 0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #13 0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 47 (Thread 7136.0x440):
    #0  0x77c5091d in ntdll!RtlGetUserInfoHeap () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x6901d3f6 in ?? ()
    No symbol table info available.
    #2  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 46 (Thread 7136.0x1d18):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 45 (Thread 7136.0x1d3c):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 44 (Thread 7136.0x17cc):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 43 (Thread 7136.0x1bc4):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 20 (Thread 7136.0x15d4):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 16 (Thread 7136.0x1ffc):
    #0  0x76e878d7 in USER32!DispatchMessageW () from C:\WINDOWS\syswow64\user32.dll
    No symbol table info available.
    #1  0x75e8999f in SHELL32!DllCanUnloadNow () from C:\WINDOWS\syswow64\shell32.dll
    No symbol table info available.
    #2  0x1db5fee0 in ?? ()
    No symbol table info available.
    #3  0x775d43c0 in SHLWAPI!IUnknown_QueryService () from C:\WINDOWS\syswow64\shlwapi.dll
    No symbol table info available.
    #4  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #5  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #7  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 12 (Thread 7136.0x1acc):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 9 (Thread 7136.0x1748):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 6 (Thread 7136.0x1108):
    #0  0x77c0016d in ntdll!ZwWaitForMultipleObjects () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c0016d in ntdll!ZwWaitForMultipleObjects () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x7441a41c in timeEndPeriod () from C:\WINDOWS\system32\winmm.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 5 (Thread 7136.0x1a20):
    #0  0x77bffda1 in ntdll!ZwDelayExecution () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77bffda1 in ntdll!ZwDelayExecution () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x76db3d3c in SleepEx () from C:\WINDOWS\syswow64\KernelBase.dll
    No symbol table info available.
    #3  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 4 (Thread 7136.0xb54):
    #0  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c01f56 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2fa3e in ntdll!TpSetTimer () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #4  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #5  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #6  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 2 (Thread 7136.0x9dc):
    #0  0x77c0016d in ntdll!ZwWaitForMultipleObjects () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c0016d in ntdll!ZwWaitForMultipleObjects () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x77c2f64f in ntdll!_allmul () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #3  0x00000005 in ?? ()
    No symbol table info available.
    #4  0x009899c0 in ?? ()
    No symbol table info available.
    #5  0x7723336a in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #6  0x77c19902 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #7  0x77c198d5 in ntdll!RtlInitializeExceptionChain () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #8  0x00000000 in ?? ()
    No symbol table info available.
    
    Thread 1 (Thread 7136.0xfb0):
    #0  0x77c0016d in ntdll!ZwWaitForMultipleObjects () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #1  0x77c0016d in ntdll!ZwWaitForMultipleObjects () from C:\WINDOWS\SysWOW64\ntdll.dll
    No symbol table info available.
    #2  0x76db171a in WaitForMultipleObjectsEx () from C:\WINDOWS\syswow64\KernelBase.dll
    No symbol table info available.
    #3  0x00000001 in ?? ()
    No symbol table info available.
    #4  0x0028dd80 in ?? ()
    No symbol table info available.
    #5  0x772319fc in WaitForMultipleObjectsEx () from C:\WINDOWS\syswow64\kernel32.dll
    No symbol table info available.
    #6  0x76e90882 in USER32!PeekMessageW () from C:\WINDOWS\syswow64\user32.dll
    No symbol table info available.
    #7  0x6bb2be3f in QEventDispatcherWin32::processEvents (this=0x160b9540, flags=...) at kernel\qeventdispatcher_win.cpp:634
            nCount = 0
            waitRet = 258
            pHandles = {0x6bcce780 <QArrayData::shared_null>, 0x0, 0x28fe48, 0x40000062, 0x970000, 0x970150, 0x0, 0x0, 0x0, 0x28df18, 0x970000, 0x28df30, 0x28de4c, 0x28df38, 0x28e400, 0x77c558c5 <ntdll!WinSqmSetIfMaxDWORD+49>, 0xfee132 <_rt_psrelocs_start+4670>, 0xfffffffe, 0x77c13406 <ntdll!RtlQueryPerformanceCounter+2738>, 0x77c13431 <ntdll!RtlQueryPerformanceCounter+2781>, 0x38, 0x0, 0x0, 0x28df90, 0x38, 0x997ca8, 0x0, 0x7716f70e <ole32!WdtpInterfacePointer_UserUnmarshal+13463>, 0x28ddf8, 0x0, 0x28dfbc, 0x77c558c5 <ntdll!WinSqmSetIfMaxDWORD+49>, 0xfe9322 <Ui_QFileDialog::setupUi(QDialog*)::{lambda()#16}::operator()() const::qstring_literal+34>, 0xfffffffe, 0x77c0f5de <ntdll!RtlImageNtHeaderEx+169>, 0x7716f7ce <ole32!WdtpInterfacePointer_UserUnmarshal+13655>, 0x76e70000, 0x28e13c, 0x0, 0x28dfe8, 0x28dfb0, 0xe8, 0x76e700e8, 0x0, 0x28df60, 0x28dfe8, 0x28dfec, 0x4, 0x0, 0x997ca8, 0x38, 0x28e410, 0x76e8df4f <UnregisterClassA+594>, 0x998cf8, 0x997ca8, 0x76e8df61 <UnregisterClassA+612>, 0x3cbff32d, 0x997ca8, 0x76ef0300, 0x0, 0x77c1c293 <ntdll!RtlRunOnceComplete+1142>, 0x7716f7ae <ole32!WdtpInterfacePointer_UserUnmarshal+13623>, 0x76e70000}
            processedTimers = {a = 256, s = 0, ptr = 0x28dfe0, {array = "æ\a\026 <<SNIP SNIP >> 000$ü(", q_for_alignment_1 = 1181117450214, q_for_alignment_2 = 5.8354955585434627e-312}}
            d = 0x17b41b48
            canWait = true
            retVal = false
            seenWM_QT_SENDPOSTEDEVENTS = false
            needWM_QT_SENDPOSTEDEVENTS = false
    #8  0x62a84385 in QWindowsGuiEventDispatcher::processEvents (this=0x160b9540, flags=...) at qwindowsguieventdispatcher.cpp:74
            oldFlags = {i = 0}
            rc = true
    #9  0x6badb3b0 in QEventLoop::processEvents (this=0x28fd94, flags=...) at kernel\qeventloop.cpp:134
            d = 0x17b5f0c0
    #10 0x6badb660 in QEventLoop::exec (this=0x28fd94, flags=...) at kernel\qeventloop.cpp:212
            d = 0x17b5f0c0
            locker = {val = 369853880}
            __PRETTY_FUNCTION__ = "int QEventLoop::exec(QEventLoop::ProcessEventsFlags)"
            ref = {d = 0x17b5f0c0, locker = @0x28fd4c, exceptionCaught = true}
            app = 0x28fe48
    #11 0x6baddd9b in QCoreApplication::exec () at kernel\qcoreapplication.cpp:1261
            threadData = 0x160b84f8
            __PRETTY_FUNCTION__ = "static int QCoreApplication::exec()"
            eventLoop = {<QObject> = {_vptr.QObject = 0x6be932bc <vtable for QEventLoop+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bd958a0 <qt_meta_stringdata_QObject>, data = 0x6bd95980 <qt_meta_data_QObject>, static_metacall = 0x6bb08bf2 <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x17b5f0c0}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6be54660 <qt_meta_stringdata_Qt>, data = 0x6be5d2a0 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x6bd95aa8 <QObject::staticMetaObject>, stringdata = 0x6be6b5a0 <qt_meta_stringdata_QEventLoop>, data = 0x6be6b600 <qt_meta_data_QEventLoop>, static_metacall = 0x6bb675dc <QEventLoop::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
            returnCode = 2686472
    #12 0x09b354fc in QGuiApplication::exec () at kernel\qguiapplication.cpp:1657
    No locals.
    #13 0x00a7ca67 in QApplication::exec () at kernel\qapplication.cpp:2921
    No locals.
    #14 0x00401682 in qMain (argc=1, argv=0x160b8320) at ..\3803820-DXF-Text-Resizer\main.cpp:10
            a = {<QGuiApplication> = {<QCoreApplication> = {<QObject> = {_vptr.QObject = 0xfdac88 <vtable for QApplication+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bd958a0 <qt_meta_stringdata_QObject>, data = 0x6bd95980 <qt_meta_data_QObject>, static_metacall = 0x6bb08bf2 <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x160b83f0}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6be54660 <qt_meta_stringdata_Qt>, data = 0x6be5d2a0 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x6bd95aa8 <QObject::staticMetaObject>, stringdata = 0x6be6b6a0 <qt_meta_stringdata_QCoreApplication>, data = 0x6be6b860 <qt_meta_data_QCoreApplication>, static_metacall = 0x6bb67718 <QCoreApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, static self = 0x28fe48}, static staticMetaObject = {d = {superdata = 0x6be6b9bc <QCoreApplication::staticMetaObject>, stringdata = 0x9f4f0c0 <qt_meta_stringdata_QGuiApplication>, data = 0x9f4f540 <qt_meta_data_QGuiApplication>, static_metacall = 0x9b3ba42 <QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x9f448e4 <QGuiApplication::staticMetaObject>, stringdata = 0xf067e0 <qt_meta_stringdata_QApplication>, data = 0xf06a60 <qt_meta_data_QApplication>, static_metacall = 0xa816da <QApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
            w = {<QMainWindow> = {<QWidget> = {<QObject> = {_vptr.QObject = 0x4054dc <vtable for MainWindow+8>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x6bd958a0 <qt_meta_stringdata_QObject>, data = 0x6bd95980 <qt_meta_data_QObject>, static_metacall = 0x6bb08bf2 <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x17b43608}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x6be54660 <qt_meta_stringdata_Qt>, data = 0x6be5d2a0 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, <QPaintDevice> = {_vptr.QPaintDevice = 0x4055b8 <vtable for MainWindow+228>, painters = 0, reserved = 0x0}, static staticMetaObject = {d = {superdata = 0x6bd95aa8 <QObject::staticMetaObject>, stringdata = 0xf0d700 <qt_meta_stringdata_QWidget>, data = 0xf0e180 <qt_meta_data_QWidget>, static_metacall = 0xabfc20 <QWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, data = 0x17b436b0}, static staticMetaObject = {d = {superdata = 0xf030ac <QWidget::staticMetaObject>, stringdata = 0xf37b80 <qt_meta_stringdata_QMainWindow>, data = 0xf37f40 <qt_meta_data_QMainWindow>, static_metacall = 0xbe5ab6 <QMainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0xf38174 <qt_meta_extradata_QMainWindow>, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0xf3817c <QMainWindow::staticMetaObject>, stringdata = 0x405140 <qt_meta_stringdata_MainWindow>, data = 0x4051a0 <qt_meta_data_MainWindow>, static_metacall = 0x401918 <MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, ui = 0x17b43360}
    #15 0x00402c90 in WinMain@16 () at qtmain_win.cpp:111
            argc = 1
            argvW = 0x97f730
            argv = 0x160b8320
            exitCode = 147
    #16 0x00403c8d in main ()
    No symbol table info available.
    

  • Moderators

    @cdwijs I doubt this line is the reason for the crash especially if it happens several minutes later. You should run your app through debugger. Also what else are you doing in your app?
    Also: is the file open dialog open when your app crashes or already closed?



  • @jsulm said in SIGSEGV after adding QFileDialog::getOpenFileName to the program:

    @cdwijs I doubt this line is the reason for the crash especially if it happens several minutes later. You should run your app through debugger. Also what else are you doing in your app?
    Also: is the file open dialog open when your app crashes or already closed?

    I am running the app via the debugger, I have looked at the callstacks of the different threads, but I could not figure out what caused the crash. Does the backtrace provide the same information, or can I copy-and-paste something from the debugger screens thats not in the backtrace?
    I am doing nothing else in my app. It's one form with one button, and one clicked() handler.
    The file open dialog is closed when the crash happens.
    The crash does not happen when I comment the line.

    I will reboot my machine, remove the build folder, and see if that solves the problem.

    Cheers,
    Cedric



  • @cdwijs

    Hi,

    probably the this pointer is no longer valid when the file dialog goes out of scope. Maybe just try it with a nullptr.

    -Michael.


  • Moderators

    @m.sue Why should it not be valid? QFileDialog::getOpenFileName is static and blocking - the execution will continue when the dialog is closed. In the mean time MainWindow cannot be destroyed.



  • I understood that the crash happens after closing the file dialog. I thought maybe even after closing the whole program. Closing the dialog does not mean that the .NET objects behind the scene are freed immediately.
    I had had similar problems on WINDOWS 7 Enterprise but only in the debug version.
    -Michael



  • I have rebooted my machine, and removed the build folder, and the .user file.
    I have tried both of the following lines, they both crash, after about 2 minutes after the load file dialog is closed:

    fileName = QFileDialog::getOpenFileName(this,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)");
    fileName = QFileDialog::getOpenFileName(Q_NULLPTR,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)");
    

    The crash also happens when the dialog is cancelled.
    The crash does not happen when the file open dialog is opened, and kept open.
    The crash does happen when the dialog is opened, cancelled, and then kept open again.

    What can I do to make this work?
    Cheers, Cedric

    [Added code tags ~kshegunov]


  • Moderators

    @cdwijs What else is your app doing?
    @m-sue We are in the native C++ universe here not .Net :-)



  • @jsulm said in SIGSEGV after adding QFileDialog::getOpenFileName to the program:

    @cdwijs What else is your app doing?
    @m-sue We are in the native C++ universe here not .Net :-)

    @jsulm: I have created the smallest program that shows the problem. Just run it, press the button, and cancel the file dialog. Then after 3 minutes the program crashes. Here is the complete source code:

    #-------------------------------------------------
    #
    # Project created by QtCreator 2017-06-09T14:42:39
    #
    #-------------------------------------------------
    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = untitled2
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
            mainwindow.cpp
    
    HEADERS  += mainwindow.h
    
    FORMS    += mainwindow.ui
    
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    
    namespace Ui {
    class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();
    
    private slots:
        void on_pushButton_clicked();
    
    private:
        Ui::MainWindow *ui;
    };
    
    #endif // MAINWINDOW_H
    
    #include "mainwindow.h"
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
    
        return a.exec();
    }
    
    
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    #include <QFileDialog>
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        QString fileName;
        fileName = QFileDialog::getOpenFileName(Q_NULLPTR,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)");
    }
    
    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
     <class>MainWindow</class>
     <widget class="QMainWindow" name="MainWindow">
      <property name="geometry">
       <rect>
        <x>0</x>
        <y>0</y>
        <width>400</width>
        <height>300</height>
       </rect>
      </property>
      <property name="windowTitle">
       <string>MainWindow</string>
      </property>
      <widget class="QWidget" name="centralWidget">
       <widget class="QPushButton" name="pushButton">
        <property name="geometry">
         <rect>
          <x>40</x>
          <y>40</y>
          <width>75</width>
          <height>23</height>
         </rect>
        </property>
        <property name="text">
         <string>PushButton</string>
        </property>
       </widget>
      </widget>
      <widget class="QMenuBar" name="menuBar">
       <property name="geometry">
        <rect>
         <x>0</x>
         <y>0</y>
         <width>400</width>
         <height>21</height>
        </rect>
       </property>
      </widget>
      <widget class="QToolBar" name="mainToolBar">
       <attribute name="toolBarArea">
        <enum>TopToolBarArea</enum>
       </attribute>
       <attribute name="toolBarBreak">
        <bool>false</bool>
       </attribute>
      </widget>
      <widget class="QStatusBar" name="statusBar"/>
     </widget>
     <layoutdefault spacing="6" margin="11"/>
     <resources/>
     <connections/>
    </ui>
    
    14:44:14: Running steps for project untitled2...
    14:44:14: Starting: "C:\Qt\5.8\mingw53_32\bin\qmake.exe" C:\Users\crldewijs\Documents\untitled2\untitled2.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
    Info: creating stash file C:\Users\crldewijs\Documents\build-untitled2-Desktop-Debug\.qmake.stash
    14:44:15: The process "C:\Qt\5.8\mingw53_32\bin\qmake.exe" exited normally.
    14:44:15: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
    mingw32-make: Nothing to be done for 'qmake_all'.
    14:44:15: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
    14:44:15: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" 
    C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Users/crldewijs/Documents/build-untitled2-Desktop-Debug'
    C:\Qt\5.8\mingw53_32\bin\uic.exe ..\untitled2\mainwindow.ui -o ui_mainwindow.h
    g++ -c -pipe -fno-keep-inline-dllexport -g -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\untitled2 -I. -I..\..\..\..\Qt\5.8\mingw53_32\include -I..\..\..\..\Qt\5.8\mingw53_32\include\QtWidgets -I..\..\..\..\Qt\5.8\mingw53_32\include\QtGui -I..\..\..\..\Qt\5.8\mingw53_32\include\QtANGLE -I..\..\..\..\Qt\5.8\mingw53_32\include\QtCore -Idebug -I. -I..\..\..\..\Qt\5.8\mingw53_32\mkspecs\win32-g++  -o debug\main.o ..\untitled2\main.cpp
    g++ -c -pipe -fno-keep-inline-dllexport -g -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\untitled2 -I. -I..\..\..\..\Qt\5.8\mingw53_32\include -I..\..\..\..\Qt\5.8\mingw53_32\include\QtWidgets -I..\..\..\..\Qt\5.8\mingw53_32\include\QtGui -I..\..\..\..\Qt\5.8\mingw53_32\include\QtANGLE -I..\..\..\..\Qt\5.8\mingw53_32\include\QtCore -Idebug -I. -I..\..\..\..\Qt\5.8\mingw53_32\mkspecs\win32-g++  -o debug\mainwindow.o ..\untitled2\mainwindow.cpp
    g++ -pipe -fno-keep-inline-dllexport -g -std=gnu++11 -frtti -Wall -Wextra -dM -E -o debug\moc_predefs.h ..\..\..\..\Qt\5.8\mingw53_32\mkspecs\features\data\dummy.cpp
    C:\Qt\5.8\mingw53_32\bin\moc.exe -DUNICODE -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include debug/moc_predefs.h -IC:/Qt/5.8/mingw53_32/mkspecs/win32-g++ -IC:/Users/crldewijs/Documents/untitled2 -IC:/Qt/5.8/mingw53_32/include -IC:/Qt/5.8/mingw53_32/include/QtWidgets -IC:/Qt/5.8/mingw53_32/include/QtGui -IC:/Qt/5.8/mingw53_32/include/QtANGLE -IC:/Qt/5.8/mingw53_32/include/QtCore -I. -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include-fixed -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++ -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32 -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward ..\untitled2\mainwindow.h -o debug\moc_mainwindow.cpp
    g++ -c -pipe -fno-keep-inline-dllexport -g -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\untitled2 -I. -I..\..\..\..\Qt\5.8\mingw53_32\include -I..\..\..\..\Qt\5.8\mingw53_32\include\QtWidgets -I..\..\..\..\Qt\5.8\mingw53_32\include\QtGui -I..\..\..\..\Qt\5.8\mingw53_32\include\QtANGLE -I..\..\..\..\Qt\5.8\mingw53_32\include\QtCore -Idebug -I. -I..\..\..\..\Qt\5.8\mingw53_32\mkspecs\win32-g++  -o debug\moc_mainwindow.o debug\moc_mainwindow.cpp
    g++ -Wl,-subsystem,windows -mthreads -o debug\untitled2.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o  -lmingw32 -LC:\Qt\5.8\mingw53_32\lib C:\Qt\5.8\mingw53_32\lib\libqtmaind.a -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -lshell32 C:\Qt\5.8\mingw53_32\lib\libQt5Widgetsd.a C:\Qt\5.8\mingw53_32\lib\libQt5Guid.a C:\Qt\5.8\mingw53_32\lib\libQt5Cored.a 
    mingw32-make[1]: Leaving directory 'C:/Users/crldewijs/Documents/build-untitled2-Desktop-Debug'
    14:44:21: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
    14:44:21: Elapsed time: 00:07.
    


  • @cdwijs

    In the backtrace #9 there is a call to IUnknown_QueryService which I assume causes the error, as in #8 in the networkitemfactory dll does not know what to do about it, initiating error handling in ole32.dll.

    This maybe something completely independent of your program, like dll injection via explorer, virus scanner etc.

    -Michael.


  • Qt Champions 2016

    @jsulm said in SIGSEGV after adding QFileDialog::getOpenFileName to the program:

    In the mean time MainWindow cannot be destroyed.

    Actually it can. The blocking QEventLoop::exec is "fake" blocking, it still spins the global event loop, and as consequence Window's message loop.

    @cdwijs
    Try it without using the static overloads to exclude any funny business with the event loop:

    QFileDialog * dialog = new QFileDialog(this, ...);
    // ... setFileNameFilters and such
    dialog->show();
    
    QObject::connect(dialog, &QDialog::rejected, this, [] () {
        qDebug() << "Canceled ...";
    });
    QObject::connect(dialog, &QDialog::accepted, this, [] () {
        qDebug() << "Ok clicked ...";
    });
    

    If your problem persists, try setting the dialog to be alien (non-native) and get back with the results of your experiments. Also disable any antivirus stuff which may interfere as @m-sue suggested.



  • @kshegunov said in SIGSEGV after adding QFileDialog::getOpenFileName to the program:

    @jsulm said in SIGSEGV after adding QFileDialog::getOpenFileName to the program:

    In the mean time MainWindow cannot be destroyed.

    Actually it can. The blocking QEventLoop::exec is "fake" blocking, it still spins the global event loop, and as consequence Window's message loop.

    @cdwijs
    Try it without using the static overloads to exclude any funny business with the event loop:

    QFileDialog * dialog = new QFileDialog(this, ...);
    // ... setFileNameFilters and such
    dialog->show();
    
    QObject::connect(dialog, &QDialog::rejected, this, [] () {
        qDebug() << "Canceled ...";
    });
    QObject::connect(dialog, &QDialog::accepted, this, [] () {
        qDebug() << "Ok clicked ...";
    });
    

    If your problem persists, try setting the dialog to be alien (non-native) and get back with the results of your experiments. Also disable any antivirus stuff which may interfere as @m-sue suggested.

    I have tried some things, using non-native dialog works. It looks like every native dialog fails. See the below code:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    #include <QFileDialog>
    QFileDialog * dialog;
    #include <QDebug>
    
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        dialog = new QFileDialog();
        QObject::connect(dialog,&QFileDialog::fileSelected,this, [] () {qDebug()<<"fileselected";}); //fires on pushbutton 2 dialog
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        QString fileName;
        fileName = QFileDialog::getOpenFileName(Q_NULLPTR,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)"); //sigseg after 2 minutes
    }
    
    void MainWindow::on_pushButton_2_clicked()
    {
        dialog->show(); //no crash (tested 9 minutes), looks non-native
    }
    
    
    
    void MainWindow::on_pushButton_3_clicked()
    {
        QString fileName;
        fileName = dialog->getOpenFileName(Q_NULLPTR,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)"); //sigseg after 2 minutes
    }
    
    void MainWindow::on_pushButton_4_clicked()
    {
        QString fileName;
        fileName = dialog->getOpenFileName(); //sigseg after 2 minutes
    }
    
    
    
    void MainWindow::on_pushButton_5_clicked()
    {
        QString fileName;
        fileName = QFileDialog::getOpenFileName(Q_NULLPTR,tr("Open File"),"","Dxf Files(*.dxf);;All files(*.*)",Q_NULLPTR,QFileDialog::DontUseNativeDialog); //no crash, looks non-native
    }
    


  • I don't know if this is helpful or not but I ran into a problem a few years back that reminds me of this. A (non-Qt) software I dealt with would crash every time the the user would access the file dialogs (open, save) and it seemed to happen only to certain people. If files were loaded from the recent file list everything was fine. Everything worked until you tried to do something with the file dialogs.

    The problem turned out to be a name collision of a DLL and Office 2013. With Office 2013 installed everytime the open or save dialog was called and there was a DLL present with a name it thought was somehow assocated with Office 2013 the result was a crash. The solution this (rather large) software company came up with was to rename their DLL file (lol).

    First I am assuming your program would work on a clean install of Windows 7 with nothing else installed. I have never had this kind of problem using the Qt file dialogs (not like this at least) so I suspect this would be true. I have not used Qt 5.8.x but 5.6.x does not have this problem on Win7.



  • @cdwijs Hi, friend, welcome.

    did you try add QFileDialog::DontUseNativeDialog ?

    i got crash problem in my windows system before . I used the Qt Don't Native Dialog, It worked out. I guess it was the Permission issues. sometime, use the native dialog, it will crashed. but sometimes, it also can worked well.

    
    #ifdef USE_NATIVE_DIALOG
        path = QFileDialog::getOpenFileName(this,tr("select file"), lastDir,FILE_FILTER, 0,QFileDialog::DontUseNativeDialog );
    #else
        path = QFileDialog::getOpenFileName(this,tr("select file"), lastDir, FILE_FILTER);
    #endif
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.