solvcon / modmesh

Toolkit for solving partial differential equations
BSD 3-Clause "New" or "Revised" License
39 stars 42 forks source link

Windows: viewer crashed when opening linear_wave #132

Open tigercosmos opened 2 years ago

tigercosmos commented 2 years ago

Windows11, VS2022, QT6.3.2, source code with the latest master

when loading an app except the sample_mesh, it will crash with:

Unhandled exception at 0x00007FF9CB82428C in viewer.exe: Microsoft C++ exception: pybind11::error_already_set at memory location 0x00000085989B7E68.
    KernelBase.dll!00007ff9cb82428c()   Unknown
    vcruntime140d.dll!00007ff901cab650()    Unknown
>   viewer.exe!pybind11::module_::import(const char * name) Line 1199   C++
    viewer.exe!modmesh::RApplication::{ctor}::__l2::<lambda_3>::operator()() Line 96    C++
    [External Code] 
    viewer.exe!QtPrivate::FunctorCall<QtPrivate::IndexesList<>,QtPrivate::List<>,void,std::function<void __cdecl(void)>>::call(std::function<void __cdecl(void)> & f, void * * arg) Line 163    C++
    viewer.exe!QtPrivate::Functor<std::function<void __cdecl(void)>,0>::call<QtPrivate::List<>,void>(std::function<void __cdecl(void)> & f, void * __formal, void * * arg) Line 278 C++
    viewer.exe!QtPrivate::QFunctorSlotObject<std::function<void __cdecl(void)>,0,QtPrivate::List<>,void>::impl(int which, QtPrivate::QSlotObjectBase * this_, QObject * r, void * * a, bool * ret) Line 450 C++
    Qt6Cored.dll!QtPrivate::QSlotObjectBase::call(QObject * r, void * * a) Line 399 C++
    Qt6Cored.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 3921 C++
    Qt6Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3982    C++
    Qt6Guid.dll!QAction::triggered(bool _t1) Line 501   C++
    Qt6Guid.dll!QAction::activate(QAction::ActionEvent event) Line 1133 C++
    Qt6Widgetsd.dll!QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget>> & causedStack, QAction * action, QAction::ActionEvent action_e, bool self) Line 1430   C++
    Qt6Widgetsd.dll!QMenuPrivate::activateAction(QAction * action, QAction::ActionEvent action_e, bool self) Line 1508  C++
    Qt6Widgetsd.dll!QMenu::mouseReleaseEvent(QMouseEvent * e) Line 2931 C++
    Qt6Widgetsd.dll!QWidget::event(QEvent * event) Line 8834    C++
    Qt6Widgetsd.dll!QMenu::event(QEvent * e) Line 3056  C++
    Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3350    C++
    Qt6Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2839  C++
    Qt6Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1067    C++
    Qt6Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 1498   C++
    Qt6Widgetsd.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous, bool onlyDispatchEnterLeave) Line 2423 C++
    Qt6Widgetsd.dll!QWidgetWindow::handleMouseEvent(QMouseEvent * event) Line 564   C++
    Qt6Widgetsd.dll!QWidgetWindow::event(QEvent * event) Line 286   C++
    Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3350    C++
    Qt6Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3301  C++
    Qt6Cored.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1067    C++
    Qt6Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 1498   C++
    Qt6Guid.dll!QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent * e) Line 2278  C++
    Qt6Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * e) Line 2027    C++
    Qt6Guid.dll!QWindowSystemInterface::sendWindowSystemEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1143  C++
    Qt6Guid.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 81  C++
    Qt6Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 476    C++
    Qt6Guid.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 72 C++
    Qt6Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 137   C++
    Qt6Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 218    C++
    Qt6Cored.dll!QCoreApplication::exec() Line 1388 C++
    Qt6Guid.dll!QGuiApplication::exec() Line 1888   C++
    Qt6Widgetsd.dll!QApplication::exec() Line 2632  C++
    viewer.exe!main(int argc, char * * argv) Line 63    C++
    viewer.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 97   C++
yungyuc commented 2 years ago

It looks like an uncaught Python exception of missing module on import. Could you try adding Python exception handling code around it to see what is the Python call stack?

And most likely you did not have PySide6 installed.

tigercosmos commented 2 years ago

https://github.com/solvcon/modmesh/issues/106#issuecomment-1217815834

yungyuc commented 2 years ago

Do you want to use a separate issue for the Python call stack enhancement, or just this one?

tigercosmos commented 2 years ago

@yungyuc Maybe a new issue. I think they are separated.

tigercosmos commented 1 year ago

the reason is due to this line win = ApplicationWindow(), when it run super().__init__() in ApplicationWindow error message: QWidget: Must construct a QApplication before a QWidget

if MacOS or Linux work, maybe it's an issue from upstream (from matplotlib.backends.qt_compat import QtWidgets)? cc @yungyuc

yungyuc commented 1 year ago

QtWidgets uses PySide6, in which you can trace into too (through the mpl code).

tigercosmos commented 1 year ago

cc @tychuang1211

tychuang2385 commented 1 year ago

If it's about matplotlib, maybe it's related with this?

yungyuc commented 1 year ago

linear_wave is an old prototype. Once the prototype euler1d is done, it should be migrated to the new style.

tigercosmos commented 1 year ago

@yungyuc this issue is caused by win = ApplicationWindow(), which is in both old and new prototypes.

yungyuc commented 1 year ago

@tigercosmos euler1d does not work like that anymore. Please take a look at: https://github.com/solvcon/modmesh/blob/315f69c76e6015a1260a198bba029a0550b68d3f/modmesh/app/euler1d.py#L145

yungyuc commented 1 year ago

@tigercosmos could you help test if #168 fixes this issue?

yungyuc commented 1 year ago

@tigercosmos do you think this issue is still there?