Skip to content

Crash using OpenGL widget #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zyrkiel opened this issue Feb 20, 2025 · 6 comments
Closed

Crash using OpenGL widget #717

zyrkiel opened this issue Feb 20, 2025 · 6 comments

Comments

@zyrkiel
Copy link

zyrkiel commented Feb 20, 2025

Hello,

I am facing a different issues when handling OpenGL widgets inside the ads::CDockWidget.
I have been able to reproduce a crash with a light example: https://github.com/zyrkiel/Qt-Advanced-Docking-System/tree/Add-OpenGl-example

Screencast.from.2025-02-20.12-16-59.mp4

What I try to do, in this example, is to undock then dock my ads::CDockWidget that handles an OpenGL widget (here a chart with an GPU accelerated series). In that case, the MainWindow crashes when docking back the CDockWidget.
(In my project, I am using QVTKOpenGLStereoWidget that creates a different situation where the CDockWidget disappears if it is undocked from the area it has been added to)

Here is the callstack:

libQt6Core.so.6!QMetaObject::cast(const QMetaObject * const this, const QObject * obj) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/corelib/kernel/qmetaobject.cpp:395)
libQt6Widgets.so.6!QMetaObject::cast(const QMetaObject * const this, QObject * obj) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/corelib/kernel/qobjectdefs.h:241)
libQt6Widgets.so.6!qobject_cast<QWidgetWindow*>(QObject * object) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/corelib/kernel/qobject.h:419)
libQt6Widgets.so.6!QApplicationPrivate::notifyActiveWindowChange(QApplicationPrivate * const this, QWindow * previous) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/widgets/kernel/qapplication.cpp:1935)
libQt6Gui.so.6!QGuiApplicationPrivate::processFocusWindowEvent(QWindowSystemInterfacePrivate::FocusWindowEvent * e) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/gui/kernel/qguiapplication.cpp:2566)
libQt6Gui.so.6!QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * e) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/gui/kernel/qguiapplication.cpp:2092)
libQt6Gui.so.6!QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/gui/kernel/qwindowsysteminterface.cpp:1114)
libQt6XcbQpa.so.6!QXcbUnixEventDispatcher::processEvents(QXcbUnixEventDispatcher * const this, QEventLoop::ProcessEventsFlags flags) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:27)
libQt6Core.so.6!QEventLoop::processEvents(QEventLoop * const this, QEventLoop::ProcessEventsFlags flags) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/corelib/kernel/qeventloop.cpp:100)
libQt6Core.so.6!QEventLoop::exec(QEventLoop * const this, QEventLoop::ProcessEventsFlags flags) (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/corelib/kernel/qeventloop.cpp:182)
libQt6Core.so.6!QCoreApplication::exec() (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/corelib/kernel/qcoreapplication.cpp:1486)
libQt6Gui.so.6!QGuiApplication::exec() (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/gui/kernel/qguiapplication.cpp:1926)
libQt6Widgets.so.6!QApplication::exec() (/home/tgeffroy/GitRepo/git/vcpkg/buildtrees/qtbase/src/here-src-6-ac50939fe7.clean/src/widgets/kernel/qapplication.cpp:2555)
main(int argc, char ** argv) (/home/tgeffroy/GitRepo/git/Qt-Advanced-Docking-System/examples/openGL/main.cpp:16)


My config is:
Qt: 6.7.2 (through vcpkg official ports but it should not matter)
ADS: 4.4.0
OS: Ubuntu 24.04
Debug & Release

@zyrkiel
Copy link
Author

zyrkiel commented Feb 21, 2025

I have done a similar test by replacing the ads::CDockWidget by a QDockWidget. In that case, undocking and docking the dock widget containing the OpenGL chart doesn't meet the issue.

@zyrkiel
Copy link
Author

zyrkiel commented Feb 21, 2025

A colleague has tested it on Windows and cannot reproduce what happens on Ubuntu...

@githubuser0xFFFF
Copy link
Owner

Please have a look into #281

@zyrkiel
Copy link
Author

zyrkiel commented Mar 6, 2025

It's not the same as #281...

I have a first solution for the chart using openGL; floating dock container are aliens on Linux. Non native widgets doesn't have the ritght winid and that has consequences on the SurfaceType that doesn't match the OpenGLSurface forcing the widget to be recreated while dropped back in the area.
The best solution for this is to use the winid function in the DockSplitter class constructor (according to this doc:https://doc.qt.io/qt-6/qwidget.html#native-widgets-vs-alien-widgets). Others solutions proposed by the documentation are not working properly.

I am improving the example to fix the use of QOpenGLWidget and QOpenGLWindow included in a QWidget. I need more time to investigate the associated issues. Once all is working, I will propose you a MR with the example and the fix.

@githubuser0xFFFF
Copy link
Owner

Great - thank you very much.

zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 12, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 12, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 13, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 17, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 18, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 18, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 18, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 18, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 19, 2025
zyrkiel added a commit to zyrkiel/Qt-Advanced-Docking-System that referenced this issue Mar 20, 2025
@zyrkiel
Copy link
Author

zyrkiel commented Mar 20, 2025

Hello,

I finally achieved my OpenGL example and added several fix in the code.
I hope it's ok for you that I open a PR: #727

Do not hesitate to test it and send your remarks.

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants