Does cPP's exception handling mechanism mean that only throw can catch it?

has never used exception handling, so I am not clear about this. Recently, when I was working on a qt project, I considered adding this, but I simply wrote a program and found that

-sharpinclude "mainwindow.h"
-sharpinclude <QVBoxLayout>

-sharpinclude <QPushButton>
-sharpinclude <exception>


struct Node
{
    int x;
    int y;
};

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    edit = new QTextEdit;

    QPushButton* btn = new QPushButton("start");
    connect(btn, &QPushButton::clicked, this, &MainWindow::Slot);

    resize(500, 500);

    QWidget* w = new QWidget;
    QVBoxLayout* lay = new QVBoxLayout;
    lay->addWidget(btn);
    lay->addWidget(edit);
    w->setLayout(lay);

    setCentralWidget(w);
}

MainWindow::~MainWindow()
{

}

void MainWindow::Slot()
{
    try
    {
        Node* p = nullptr;
        p->x = 1;
    }
    catch (std::exception& e)
    {
        edit->setText(e.what());
    }
}

when the button is pressed, the Slot function is called, but in actual operation, the textedit box does not show any abnormal information, and the program crashes and exits directly.

I Google search articles, everyone wrote, is throw, and then try...catch. Then I asked my colleague to write the same WPF program for me, and it detected it.

so I wonder: can only throw catch cPP"s exception handling mechanism?

ask for explanation.

CPP
May.15,2022

that's right.

WPF uses. Net framework. If you use c-sharp to implement the same function, you must be able to catch exceptions.
if implemented in unmanaged code, it is also possible to catch, thanks to the windows SEH (structured exception handling) mechanism.

you can also use vc's _ _ try/__catch mode with qt to try.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ead71c-2157.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ead71c-2157.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?