[Interest] Slot exception being thrown on exit

Ramakanth Kesireddy rama.kesi at gmail.com
Wed Mar 14 03:08:00 CET 2018


Hi,

Thanks a lot for the pointers and tried both approaches but couldnot trace
the slot where exception is being thrown.
I re-implemented notify but the exception is not being caught.

class Application: public QApplication {

public:
    Application(int& argc, char** argv,int = ApplicationFlags):
QApplication(argc, argv,ApplicationFlags)
    {
        qDebug() << "Application constructor: " << endl;
    }

    virtual bool notify(QObject* receiver, QEvent* event) {
        try {
            qDebug() << "Application notify: " << endl;
            return QApplication::notify(receiver, event);
        }
        catch (const std::exception& exc) {
            qDebug() << "Application caught exc: " << exc.what() << endl;
            return true;
        }
        catch(...) {
            qDebug() << "Application caught undefined exception" << endl;
            return true;
        }
    }
};

new Application ( argc
                                , argv
                                , Application::GuiServer );

Only difference being Qt app is spawned as the child thread of other
process.
Even if I commented all the connect statements, the below exception is
being thrown:-

Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

Though it works as expected in a sample app, still unable to find the
rootcause.
Please suggest in this regard.

Thanks and Regards,
RK


On Tue, Mar 6, 2018 at 11:29 PM, Thiago Macieira <thiago.macieira at intel.com>
wrote:

> On Tuesday, 6 March 2018 09:30:21 PST Ramakanth Kesireddy wrote:
> > Please let me know if there is any way to find out the slot or
> eventhandler
> > throwing exception
> > other than running the app in debug mode with backtrace?
>
> Run in the debugger and ask it to stop in any C++ exception thrown (gdb
> command "catch throw").
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180314/c778a206/attachment.html>


More information about the Interest mailing list