Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. "Undebuggable" segmentation fault
Forum Updated to NodeBB v4.3 + New Features

"Undebuggable" segmentation fault

Scheduled Pinned Locked Moved Unsolved General and Desktop
29 Posts 3 Posters 6.2k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • kshegunovK kshegunov

    @Mark81 said in "Undebuggable" segmentation fault:

    here we are:

    Two problems with the screenshot:

    1. I can't see the whole stack (including the root), more important. Use right click and from the context menu extract it as text please.
    2. You didn't specify a context object for the lambda, which I requested in my previous post.
    M Offline
    M Offline
    Mark81
    wrote on last edited by
    #19

    @kshegunov said in "Undebuggable" segmentation fault:

    Two problems with the screenshot:

    1. I can't see the whole stack (including the root), more important. Use right click and from the context menu extract it as text please.
    2. You didn't specify a context object for the lambda, which I requested in my previous post.

    Sorry Sir, but we made a lot of trials. I wasn't sure about which code you want. By the way it's another syntax, very different! Why? Here the update screenshot and text:

    0_1548257990470_Clipboard 1.jpg

    Full backtrace attached as it's too big for the post. Here just the same info extracted as text:

    1  SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}::operator()() const                                                                                                              customdelegateoperators.h      37   0x492bb0   
    2  QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}>::call({lambda()#1}&, void * *)                        qobjectdefs_impl.h             128  0x48739a   
    3  QtPrivate::Functor<SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}, 0>::call<QtPrivate::List<>, void>({lambda()#1}&, void *, {lambda()#1}& *)                                    qobjectdefs_impl.h             238  0x48bf44   
    4  QtPrivate::QFunctorSlotObject<SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void * *, bool *) qobjectdefs_impl.h             421  0x48ba8d   
    5  QtPrivate::QSlotObjectBase::call                                                                                                                                                           qobjectdefs_impl.h             376  0x281c173  
    6  QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3754 0x281c173  
    7  QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3633 0x281c575  
    8  QAbstractButton::clicked                                                                                                                                                                   moc_qabstractbutton.cpp        308  0x1b48b7ac 
    9  QAbstractButtonPrivate::emitClicked                                                                                                                                                        qabstractbutton.cpp            414  0x1b48b9d5 
    10 QAbstractButtonPrivate::click                                                                                                                                                              qabstractbutton.cpp            407  0x1b48d17a 
    11 QAbstractButton::mouseReleaseEvent                                                                                                                                                         qabstractbutton.cpp            1011 0x1b48d3aa 
    12 QToolButton::mouseReleaseEvent                                                                                                                                                             qtoolbutton.cpp                622  0x1b576fd1 
    13 QWidget::event                                                                                                                                                                             qwidget.cpp                    8901 0x1b3db0e0 
    14 QAbstractButton::event                                                                                                                                                                     qabstractbutton.cpp            968  0x1b48e7bc 
    15 QToolButton::event                                                                                                                                                                         qtoolbutton.cpp                985  0x1b57711e 
    16 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
    17 QApplication::notify                                                                                                                                                                       qapplication.cpp               3203 0x1b3a0107 
    18 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
    19 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x1b39f077 
    20 QApplicationPrivate::sendMouseEvent                                                                                                                                                        qapplication.cpp               2693 0x1b39f077 
    21 QWidgetWindow::handleMouseEvent                                                                                                                                                            qwidgetwindow.cpp              660  0x1b3f1af4 
    22 QWidgetWindow::event                                                                                                                                                                       qwidgetwindow.cpp              281  0x1b3f3bf9 
    23 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
    24 QApplication::notify                                                                                                                                                                       qapplication.cpp               3099 0x1b39fb83 
    25 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
    26 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x99cabfc  
    27 QGuiApplicationPrivate::processMouseEvent                                                                                                                                                  qguiapplication.cpp            2081 0x99cabfc  
    28 QGuiApplicationPrivate::processWindowSystemEvent                                                                                                                                           qguiapplication.cpp            1816 0x99cc4d7  
    29 QWindowSystemInterface::sendWindowSystemEvents                                                                                                                                             qwindowsysteminterface.cpp     1032 0x99adf99  
    30 QWindowsGuiEventDispatcher::sendPostedEvents                                                                                                                                               qwindowsguieventdispatcher.cpp 82   0x2883dae4 
    31 qt_internal_proc(HWND__ *, unsigned int, unsigned int, long) *16                                                                                                                           qeventdispatcher_win.cpp       237  0x284538d  
    32 gapfnScSendMessage                                                                                                                                                                                                             0x769f62fa 
    33 ??                                                                                                                                                                                                                             0x62047e   
    34 USER32!GetThreadDesktop                                                                                                                                                                                                        0x769f6d3a 
    35 QEventDispatcherWin32Private::sendTimerEvent                                                                                                                                               qeventdispatcher_win.cpp       456  0x2844dc9  
    36 ??                                                                                                                                                                                                                             0x62047e   
    37 USER32!CharPrevW                                                                                                                                                                                                               0x769f77c4 
    38 USER32!DispatchMessageW                                                                                                                                                                                                        0x769f788a 
    39 QEventDispatcherWin32::processEvents                                                                                                                                                       qeventdispatcher_win.cpp       629  0x2844ae8  
    40 QWindowsGuiEventDispatcher::processEvents                                                                                                                                                  qwindowsguieventdispatcher.cpp 74   0x2883dab7 
    41 QEventLoop::processEvents                                                                                                                                                                  qeventloop.cpp                 136  0x27f37c8  
    42 QEventLoop::exec                                                                                                                                                                           qeventloop.cpp                 214  0x27f3c20  
    43 QDialog::exec                                                                                                                                                                              qdialog.cpp                    546  0x1b5907de 
    44 MainWindow::on_actionImpostazioni_triggered                                                                                                                                                mainwindow.cpp                 1518 0x40e152   
    45 MainWindow::qt_static_metacall                                                                                                                                                             moc_mainwindow.cpp             298  0x43f973   
    46 MainWindow::qt_metacall                                                                                                                                                                    moc_mainwindow.cpp             368  0x43fcc2   
    47 QMetaObject::metacall                                                                                                                                                                      qmetaobject.cpp                301  0x27fe365  
    48 QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3786 0x281c37f  
    49 QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3633 0x281c575  
    50 QAction::triggered                                                                                                                                                                         moc_qaction.cpp                376  0x1b391618 
    51 QAction::activate                                                                                                                                                                          qaction.cpp                    1167 0x1b394579 
    52 QMenuPrivate::activateCausedStack                                                                                                                                                          qmenu.cpp                      1371 0x1b50d432 
    53 QMenuPrivate::activateAction                                                                                                                                                               qmenu.cpp                      1448 0x1b51507e 
    54 QMenu::mouseReleaseEvent                                                                                                                                                                   qmenu.cpp                      2942 0x1b515c07 
    55 QWidget::event                                                                                                                                                                             qwidget.cpp                    8901 0x1b3db0e0 
    56 QMenu::event                                                                                                                                                                               qmenu.cpp                      3064 0x1b5180de 
    57 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
    58 QApplication::notify                                                                                                                                                                       qapplication.cpp               3203 0x1b3a0107 
    59 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
    60 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x1b39f077 
    61 QApplicationPrivate::sendMouseEvent                                                                                                                                                        qapplication.cpp               2693 0x1b39f077 
    62 QWidgetWindow::handleMouseEvent                                                                                                                                                            qwidgetwindow.cpp              556  0x1b3f0ed3 
    63 QWidgetWindow::event                                                                                                                                                                       qwidgetwindow.cpp              281  0x1b3f3bf9 
    64 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
    65 QApplication::notify                                                                                                                                                                       qapplication.cpp               3099 0x1b39fb83 
    66 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
    67 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x99cabfc  
    68 QGuiApplicationPrivate::processMouseEvent                                                                                                                                                  qguiapplication.cpp            2081 0x99cabfc  
    69 QGuiApplicationPrivate::processWindowSystemEvent                                                                                                                                           qguiapplication.cpp            1816 0x99cc4d7  
    70 QWindowSystemInterface::sendWindowSystemEvents                                                                                                                                             qwindowsysteminterface.cpp     1032 0x99adf99  
    71 QWindowsGuiEventDispatcher::sendPostedEvents                                                                                                                                               qwindowsguieventdispatcher.cpp 82   0x2883dae4 
    72 qt_internal_proc(HWND__ *, unsigned int, unsigned int, long) *16                                                                                                                           qeventdispatcher_win.cpp       237  0x284538d  
    73 gapfnScSendMessage                                                                                                                                                                                                             0x769f62fa 
    74 ??                                                                                                                                                                                                                             0x62047e   
    75 USER32!GetThreadDesktop                                                                                                                                                                                                        0x769f6d3a 
    76 QEventDispatcherWin32Private::sendTimerEvent                                                                                                                                               qeventdispatcher_win.cpp       456  0x2844dc9  
    77 ??                                                                                                                                                                                                                             0x62047e   
    78 USER32!CharPrevW                                                                                                                                                                                                               0x769f77c4 
    79 USER32!DispatchMessageW                                                                                                                                                                                                        0x769f788a 
    80 QEventDispatcherWin32::processEvents                                                                                                                                                       qeventdispatcher_win.cpp       629  0x2844ae8  
    81 QWindowsGuiEventDispatcher::processEvents                                                                                                                                                  qwindowsguieventdispatcher.cpp 74   0x2883dab7 
    82 QEventLoop::processEvents                                                                                                                                                                  qeventloop.cpp                 136  0x27f37c8  
    83 QEventLoop::exec                                                                                                                                                                           qeventloop.cpp                 214  0x27f3c20  
    84 QCoreApplication::exec                                                                                                                                                                     qcoreapplication.cpp           1336 0x27fc30e  
    85 QGuiApplication::exec                                                                                                                                                                      qguiapplication.cpp            1761 0x99c1552  
    86 QApplication::exec                                                                                                                                                                         qapplication.cpp               2901 0x1b3984a9 
    87 qMain                                                                                                                                                                                      main.cpp                       37   0x401859   
    88 WinMain *16                                                                                                                                                                                qtmain_win.cpp                 104  0x447465   
    89 main                                                                                                                                                                                                                           0x49883d   [0_1548258146048_backtrace.txt](Uploading 100%) 
    
    kshegunovK 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #20

      Hi
      Just to be 100% sure.
      You still have the checks at your casts, right ?

      SignatureEditor *widget = qobject_cast<SignatureEditor *>(editor); // Note qobject_cast !
      if (widget) {
        widget->setText(value);
        widget->activate();
      } else
        qDebug() << "invalid cast for editor";
      
      1 Reply Last reply
      1
      • M Mark81

        @kshegunov said in "Undebuggable" segmentation fault:

        Two problems with the screenshot:

        1. I can't see the whole stack (including the root), more important. Use right click and from the context menu extract it as text please.
        2. You didn't specify a context object for the lambda, which I requested in my previous post.

        Sorry Sir, but we made a lot of trials. I wasn't sure about which code you want. By the way it's another syntax, very different! Why? Here the update screenshot and text:

        0_1548257990470_Clipboard 1.jpg

        Full backtrace attached as it's too big for the post. Here just the same info extracted as text:

        1  SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}::operator()() const                                                                                                              customdelegateoperators.h      37   0x492bb0   
        2  QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}>::call({lambda()#1}&, void * *)                        qobjectdefs_impl.h             128  0x48739a   
        3  QtPrivate::Functor<SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}, 0>::call<QtPrivate::List<>, void>({lambda()#1}&, void *, {lambda()#1}& *)                                    qobjectdefs_impl.h             238  0x48bf44   
        4  QtPrivate::QFunctorSlotObject<SignatureEditor::SignatureEditor(QWidget *)::{lambda()#1}, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void * *, bool *) qobjectdefs_impl.h             421  0x48ba8d   
        5  QtPrivate::QSlotObjectBase::call                                                                                                                                                           qobjectdefs_impl.h             376  0x281c173  
        6  QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3754 0x281c173  
        7  QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3633 0x281c575  
        8  QAbstractButton::clicked                                                                                                                                                                   moc_qabstractbutton.cpp        308  0x1b48b7ac 
        9  QAbstractButtonPrivate::emitClicked                                                                                                                                                        qabstractbutton.cpp            414  0x1b48b9d5 
        10 QAbstractButtonPrivate::click                                                                                                                                                              qabstractbutton.cpp            407  0x1b48d17a 
        11 QAbstractButton::mouseReleaseEvent                                                                                                                                                         qabstractbutton.cpp            1011 0x1b48d3aa 
        12 QToolButton::mouseReleaseEvent                                                                                                                                                             qtoolbutton.cpp                622  0x1b576fd1 
        13 QWidget::event                                                                                                                                                                             qwidget.cpp                    8901 0x1b3db0e0 
        14 QAbstractButton::event                                                                                                                                                                     qabstractbutton.cpp            968  0x1b48e7bc 
        15 QToolButton::event                                                                                                                                                                         qtoolbutton.cpp                985  0x1b57711e 
        16 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
        17 QApplication::notify                                                                                                                                                                       qapplication.cpp               3203 0x1b3a0107 
        18 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
        19 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x1b39f077 
        20 QApplicationPrivate::sendMouseEvent                                                                                                                                                        qapplication.cpp               2693 0x1b39f077 
        21 QWidgetWindow::handleMouseEvent                                                                                                                                                            qwidgetwindow.cpp              660  0x1b3f1af4 
        22 QWidgetWindow::event                                                                                                                                                                       qwidgetwindow.cpp              281  0x1b3f3bf9 
        23 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
        24 QApplication::notify                                                                                                                                                                       qapplication.cpp               3099 0x1b39fb83 
        25 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
        26 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x99cabfc  
        27 QGuiApplicationPrivate::processMouseEvent                                                                                                                                                  qguiapplication.cpp            2081 0x99cabfc  
        28 QGuiApplicationPrivate::processWindowSystemEvent                                                                                                                                           qguiapplication.cpp            1816 0x99cc4d7  
        29 QWindowSystemInterface::sendWindowSystemEvents                                                                                                                                             qwindowsysteminterface.cpp     1032 0x99adf99  
        30 QWindowsGuiEventDispatcher::sendPostedEvents                                                                                                                                               qwindowsguieventdispatcher.cpp 82   0x2883dae4 
        31 qt_internal_proc(HWND__ *, unsigned int, unsigned int, long) *16                                                                                                                           qeventdispatcher_win.cpp       237  0x284538d  
        32 gapfnScSendMessage                                                                                                                                                                                                             0x769f62fa 
        33 ??                                                                                                                                                                                                                             0x62047e   
        34 USER32!GetThreadDesktop                                                                                                                                                                                                        0x769f6d3a 
        35 QEventDispatcherWin32Private::sendTimerEvent                                                                                                                                               qeventdispatcher_win.cpp       456  0x2844dc9  
        36 ??                                                                                                                                                                                                                             0x62047e   
        37 USER32!CharPrevW                                                                                                                                                                                                               0x769f77c4 
        38 USER32!DispatchMessageW                                                                                                                                                                                                        0x769f788a 
        39 QEventDispatcherWin32::processEvents                                                                                                                                                       qeventdispatcher_win.cpp       629  0x2844ae8  
        40 QWindowsGuiEventDispatcher::processEvents                                                                                                                                                  qwindowsguieventdispatcher.cpp 74   0x2883dab7 
        41 QEventLoop::processEvents                                                                                                                                                                  qeventloop.cpp                 136  0x27f37c8  
        42 QEventLoop::exec                                                                                                                                                                           qeventloop.cpp                 214  0x27f3c20  
        43 QDialog::exec                                                                                                                                                                              qdialog.cpp                    546  0x1b5907de 
        44 MainWindow::on_actionImpostazioni_triggered                                                                                                                                                mainwindow.cpp                 1518 0x40e152   
        45 MainWindow::qt_static_metacall                                                                                                                                                             moc_mainwindow.cpp             298  0x43f973   
        46 MainWindow::qt_metacall                                                                                                                                                                    moc_mainwindow.cpp             368  0x43fcc2   
        47 QMetaObject::metacall                                                                                                                                                                      qmetaobject.cpp                301  0x27fe365  
        48 QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3786 0x281c37f  
        49 QMetaObject::activate                                                                                                                                                                      qobject.cpp                    3633 0x281c575  
        50 QAction::triggered                                                                                                                                                                         moc_qaction.cpp                376  0x1b391618 
        51 QAction::activate                                                                                                                                                                          qaction.cpp                    1167 0x1b394579 
        52 QMenuPrivate::activateCausedStack                                                                                                                                                          qmenu.cpp                      1371 0x1b50d432 
        53 QMenuPrivate::activateAction                                                                                                                                                               qmenu.cpp                      1448 0x1b51507e 
        54 QMenu::mouseReleaseEvent                                                                                                                                                                   qmenu.cpp                      2942 0x1b515c07 
        55 QWidget::event                                                                                                                                                                             qwidget.cpp                    8901 0x1b3db0e0 
        56 QMenu::event                                                                                                                                                                               qmenu.cpp                      3064 0x1b5180de 
        57 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
        58 QApplication::notify                                                                                                                                                                       qapplication.cpp               3203 0x1b3a0107 
        59 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
        60 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x1b39f077 
        61 QApplicationPrivate::sendMouseEvent                                                                                                                                                        qapplication.cpp               2693 0x1b39f077 
        62 QWidgetWindow::handleMouseEvent                                                                                                                                                            qwidgetwindow.cpp              556  0x1b3f0ed3 
        63 QWidgetWindow::event                                                                                                                                                                       qwidgetwindow.cpp              281  0x1b3f3bf9 
        64 QApplicationPrivate::notify_helper                                                                                                                                                         qapplication.cpp               3727 0x1b3985ca 
        65 QApplication::notify                                                                                                                                                                       qapplication.cpp               3099 0x1b39fb83 
        66 QCoreApplication::notifyInternal2                                                                                                                                                          qcoreapplication.cpp           1048 0x27f5119  
        67 QCoreApplication::sendSpontaneousEvent                                                                                                                                                     qcoreapplication.h             237  0x99cabfc  
        68 QGuiApplicationPrivate::processMouseEvent                                                                                                                                                  qguiapplication.cpp            2081 0x99cabfc  
        69 QGuiApplicationPrivate::processWindowSystemEvent                                                                                                                                           qguiapplication.cpp            1816 0x99cc4d7  
        70 QWindowSystemInterface::sendWindowSystemEvents                                                                                                                                             qwindowsysteminterface.cpp     1032 0x99adf99  
        71 QWindowsGuiEventDispatcher::sendPostedEvents                                                                                                                                               qwindowsguieventdispatcher.cpp 82   0x2883dae4 
        72 qt_internal_proc(HWND__ *, unsigned int, unsigned int, long) *16                                                                                                                           qeventdispatcher_win.cpp       237  0x284538d  
        73 gapfnScSendMessage                                                                                                                                                                                                             0x769f62fa 
        74 ??                                                                                                                                                                                                                             0x62047e   
        75 USER32!GetThreadDesktop                                                                                                                                                                                                        0x769f6d3a 
        76 QEventDispatcherWin32Private::sendTimerEvent                                                                                                                                               qeventdispatcher_win.cpp       456  0x2844dc9  
        77 ??                                                                                                                                                                                                                             0x62047e   
        78 USER32!CharPrevW                                                                                                                                                                                                               0x769f77c4 
        79 USER32!DispatchMessageW                                                                                                                                                                                                        0x769f788a 
        80 QEventDispatcherWin32::processEvents                                                                                                                                                       qeventdispatcher_win.cpp       629  0x2844ae8  
        81 QWindowsGuiEventDispatcher::processEvents                                                                                                                                                  qwindowsguieventdispatcher.cpp 74   0x2883dab7 
        82 QEventLoop::processEvents                                                                                                                                                                  qeventloop.cpp                 136  0x27f37c8  
        83 QEventLoop::exec                                                                                                                                                                           qeventloop.cpp                 214  0x27f3c20  
        84 QCoreApplication::exec                                                                                                                                                                     qcoreapplication.cpp           1336 0x27fc30e  
        85 QGuiApplication::exec                                                                                                                                                                      qguiapplication.cpp            1761 0x99c1552  
        86 QApplication::exec                                                                                                                                                                         qapplication.cpp               2901 0x1b3984a9 
        87 qMain                                                                                                                                                                                      main.cpp                       37   0x401859   
        88 WinMain *16                                                                                                                                                                                qtmain_win.cpp                 104  0x447465   
        89 main                                                                                                                                                                                                                           0x49883d   [0_1548258146048_backtrace.txt](Uploading 100%) 
        
        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #21

        @Mark81 said in "Undebuggable" segmentation fault:

        Sorry Sir, but we made a lot of trials. I wasn't sure about which code you want. By the way it's another syntax, very different! Why?

        No need for the formality. This overload of the connect makes sure that this exists at the point of the lambda call, the other doesn't that's why I wanted it specifically. The connection will be broken if this gets destroyed between the connect call and the actual lambda call, which isn't true for the overload without the context object.

        Full backtrace attached as it's too big for the post. Here just the same info extracted as text:

        This is perfectly fine, I was interested exactly in this one, the other threads are not interesting at this point. The trace looks okay.

        Humor me once again, and substitute the:

        QDialog myDialog;
        // ...
        myDialog.exec()
        

        you have in your MainWindow::on_actionImpostazioni_triggered slot with:

        QDialog * myDialog = new QDialog();
        // ...
        myDialog->show();
        

        See if that makes a difference.

        Also, could you print out the addresses of the variables involved in the lambda (you can see them in the "Application output pane" when you run the app), something like this:

        connect(_btn, &QToolButton::clicked, this, [this] () -> void  {
            QString filename = QFileDialog::getOpenFileName(nullptr, tr("Select signature image"), QDir::homePath(), tr("Portable Network Graphics (*.png)"));
            qDebug() << this << _btn << _line;
            _line->setText("test");
        });
        

        (You'd need to include <QDebug> for this)

        One more thing you could try is to add one guarded pointer to the _line pointer so you're 100% it's not destroyed in the mean time. It'd look like this:

        QPointer<QLineEdit> testPointer(_line);
        connect(_btn, &QToolButton::clicked, this, [this, testPointer] () -> void  {
            QString filename = QFileDialog::getOpenFileName(nullptr, tr("Select signature image"), QDir::homePath(), tr("Portable Network Graphics (*.png)"));
            qDebug() << this << _btn << _line << testPointer;
            _line->setText("test");
        });
        

        Read and abide by the Qt Code of Conduct

        M 1 Reply Last reply
        1
        • kshegunovK kshegunov

          @Mark81 said in "Undebuggable" segmentation fault:

          Sorry Sir, but we made a lot of trials. I wasn't sure about which code you want. By the way it's another syntax, very different! Why?

          No need for the formality. This overload of the connect makes sure that this exists at the point of the lambda call, the other doesn't that's why I wanted it specifically. The connection will be broken if this gets destroyed between the connect call and the actual lambda call, which isn't true for the overload without the context object.

          Full backtrace attached as it's too big for the post. Here just the same info extracted as text:

          This is perfectly fine, I was interested exactly in this one, the other threads are not interesting at this point. The trace looks okay.

          Humor me once again, and substitute the:

          QDialog myDialog;
          // ...
          myDialog.exec()
          

          you have in your MainWindow::on_actionImpostazioni_triggered slot with:

          QDialog * myDialog = new QDialog();
          // ...
          myDialog->show();
          

          See if that makes a difference.

          Also, could you print out the addresses of the variables involved in the lambda (you can see them in the "Application output pane" when you run the app), something like this:

          connect(_btn, &QToolButton::clicked, this, [this] () -> void  {
              QString filename = QFileDialog::getOpenFileName(nullptr, tr("Select signature image"), QDir::homePath(), tr("Portable Network Graphics (*.png)"));
              qDebug() << this << _btn << _line;
              _line->setText("test");
          });
          

          (You'd need to include <QDebug> for this)

          One more thing you could try is to add one guarded pointer to the _line pointer so you're 100% it's not destroyed in the mean time. It'd look like this:

          QPointer<QLineEdit> testPointer(_line);
          connect(_btn, &QToolButton::clicked, this, [this, testPointer] () -> void  {
              QString filename = QFileDialog::getOpenFileName(nullptr, tr("Select signature image"), QDir::homePath(), tr("Portable Network Graphics (*.png)"));
              qDebug() << this << _btn << _line << testPointer;
              _line->setText("test");
          });
          
          M Offline
          M Offline
          Mark81
          wrote on last edited by
          #22

          @kshegunov thanks for the detailed answer and for your effort.
          The debugger says "no valid expression" for everything inside the lambda function, is it normal?

          Let's summarize:

          qDebug() << this << _btn << _line; leads to a SIGSEGV

          qDebug() << this << _btn << _line << testPointer; leads to SIGILL

          qDebug() << _btn << _line; leads also to a SIGSEGV

          but removing the file dialog call:

                 QPointer<QLineEdit> testPointer(_line);
                 connect(_btn, &QToolButton::clicked, this, [this, testPointer] () -> void  {
                     qDebug() << this << _btn << _line << testPointer;
                     _line->setText("test");
                 });
          

          prints out:

          SignatureEditor(0x2f09b430) QToolButton(0x2e1910b0) QLineEdit(0x2e2e13e0) QLineEdit(0x2e2e13e0)

          kshegunovK 1 Reply Last reply
          0
          • M Mark81

            @kshegunov thanks for the detailed answer and for your effort.
            The debugger says "no valid expression" for everything inside the lambda function, is it normal?

            Let's summarize:

            qDebug() << this << _btn << _line; leads to a SIGSEGV

            qDebug() << this << _btn << _line << testPointer; leads to SIGILL

            qDebug() << _btn << _line; leads also to a SIGSEGV

            but removing the file dialog call:

                   QPointer<QLineEdit> testPointer(_line);
                   connect(_btn, &QToolButton::clicked, this, [this, testPointer] () -> void  {
                       qDebug() << this << _btn << _line << testPointer;
                       _line->setText("test");
                   });
            

            prints out:

            SignatureEditor(0x2f09b430) QToolButton(0x2e1910b0) QLineEdit(0x2e2e13e0) QLineEdit(0x2e2e13e0)

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by kshegunov
            #23

            @Mark81 said in "Undebuggable" segmentation fault:

            The debugger says "no valid expression" for everything inside the lambda function, is it normal?

            Not really. What compiler, debugger are you using and what are their versions? Just the other day I had stumbled on a bug in one specific version of MSVC's code generation where it didn't properly copy objects that are passed by value in the lambda capture.

            but removing the file dialog call:
            [snip]
            prints out:

            The addresses are good. So for some reason the file dialog invalidates the object(s). This can happen in principle, depending on event order, because the static function spins the event loop. Can you try something else then (same idea):

            connect(_btn, &QToolButton::clicked, this, [this] () -> void  {
                // Here use the non-static way of opening the dialog
                QFileDialog * myDialog = new QFileDialog();
                QObject::connect(myDialog, &QDialog::accepted, this, [this] () -> void  {
                    qDebug() << "If we see this message it's all good, otherwise `this` is deleted through `QDialog::exec`";
                });
                myDialog->show();
                //_line->setText("test");
            });
            

            Edit: Updated code, because I forgot to add the context parameter for connect

            Read and abide by the Qt Code of Conduct

            M 1 Reply Last reply
            1
            • kshegunovK kshegunov

              @Mark81 said in "Undebuggable" segmentation fault:

              The debugger says "no valid expression" for everything inside the lambda function, is it normal?

              Not really. What compiler, debugger are you using and what are their versions? Just the other day I had stumbled on a bug in one specific version of MSVC's code generation where it didn't properly copy objects that are passed by value in the lambda capture.

              but removing the file dialog call:
              [snip]
              prints out:

              The addresses are good. So for some reason the file dialog invalidates the object(s). This can happen in principle, depending on event order, because the static function spins the event loop. Can you try something else then (same idea):

              connect(_btn, &QToolButton::clicked, this, [this] () -> void  {
                  // Here use the non-static way of opening the dialog
                  QFileDialog * myDialog = new QFileDialog();
                  QObject::connect(myDialog, &QDialog::accepted, this, [this] () -> void  {
                      qDebug() << "If we see this message it's all good, otherwise `this` is deleted through `QDialog::exec`";
                  });
                  myDialog->show();
                  //_line->setText("test");
              });
              

              Edit: Updated code, because I forgot to add the context parameter for connect

              M Offline
              M Offline
              Mark81
              wrote on last edited by
              #24

              @kshegunov said in "Undebuggable" segmentation fault:

              Not really. What compiler, debugger are you using and what are their versions?

              MinGW 5.3.0 32bit
              GNU gdb 7.10.1 for MinGW 5.3.0 32bit
              Qt5.11.1
              Windows 7 PRO 64bit

              The addresses are good. So for some reason the file dialog invalidates the object(s). This can happen in principle, depending on event order, because the static function spins the event loop. Can you try something else then (same idea):

              No message, sadly...

              kshegunovK 1 Reply Last reply
              0
              • M Offline
                M Offline
                Mark81
                wrote on last edited by
                #25
                This post is deleted!
                1 Reply Last reply
                0
                • M Mark81

                  @kshegunov said in "Undebuggable" segmentation fault:

                  Not really. What compiler, debugger are you using and what are their versions?

                  MinGW 5.3.0 32bit
                  GNU gdb 7.10.1 for MinGW 5.3.0 32bit
                  Qt5.11.1
                  Windows 7 PRO 64bit

                  The addresses are good. So for some reason the file dialog invalidates the object(s). This can happen in principle, depending on event order, because the static function spins the event loop. Can you try something else then (same idea):

                  No message, sadly...

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #26

                  @Mark81 said in "Undebuggable" segmentation fault:

                  No message, sadly...

                  Well, you need to find out where and why your widget is destroyed before the dialog is closed. Probably the loosing of the focus causes your delegate to delete the editor, and since the dialog takes the focus ...

                  Read and abide by the Qt Code of Conduct

                  M 1 Reply Last reply
                  0
                  • kshegunovK kshegunov

                    @Mark81 said in "Undebuggable" segmentation fault:

                    No message, sadly...

                    Well, you need to find out where and why your widget is destroyed before the dialog is closed. Probably the loosing of the focus causes your delegate to delete the editor, and since the dialog takes the focus ...

                    M Offline
                    M Offline
                    Mark81
                    wrote on last edited by
                    #27

                    @kshegunov ok, but nobody has ever used a QFileDialog in a delegate?
                    I just need to let the user to select a file when enters a cell... is there a simpler way?

                    kshegunovK 1 Reply Last reply
                    0
                    • M Mark81

                      @kshegunov ok, but nobody has ever used a QFileDialog in a delegate?
                      I just need to let the user to select a file when enters a cell... is there a simpler way?

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by kshegunov
                      #28

                      UIs are fiddly, as you can tell. My advice, override: QAbstractItemDelegate::destroyEditor and add breakpoints there and in the lambda. If you get to the destroyEditor first, then for sure that's the problem. Then you can add a flag to your editor whether you are showing additional UI (i.e. the dialog), when you click the button you can raise it, and then ignore the destroyEditor call if the dialog is shown. This would also require you to connect the closing of the dialog to lower the flag, but I think it should work.

                      Read and abide by the Qt Code of Conduct

                      M 1 Reply Last reply
                      3
                      • kshegunovK kshegunov

                        UIs are fiddly, as you can tell. My advice, override: QAbstractItemDelegate::destroyEditor and add breakpoints there and in the lambda. If you get to the destroyEditor first, then for sure that's the problem. Then you can add a flag to your editor whether you are showing additional UI (i.e. the dialog), when you click the button you can raise it, and then ignore the destroyEditor call if the dialog is shown. This would also require you to connect the closing of the dialog to lower the flag, but I think it should work.

                        M Offline
                        M Offline
                        Mark81
                        wrote on last edited by
                        #29

                        @kshegunov Thanks for the advice, but it's too much effort for such a simple thing. I'm going to put a QPushButton "Browse" outside the table, so the user select a row and then press the button. It's not so nice but it would have saved me a whole day... and your time too :-)

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved