Skip to content
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

crash when rawing opacity layer in release mode with the Qt backend #1230

Closed
ogoffart opened this issue May 4, 2022 · 1 comment · Fixed by #1231
Closed

crash when rawing opacity layer in release mode with the Qt backend #1230

ogoffart opened this issue May 4, 2022 · 1 comment · Fixed by #1231
Labels
a:backend-qt The Qt backend - including the qt style (mO,bS) bug Something isn't working

Comments

@ogoffart
Copy link
Member

ogoffart commented May 4, 2022

Can be reproduce by opening the item in the pinter queue in the printer demo using the viewer or the rust build, as long as slint is build in release mode.

==591737== Invalid read of size 8
==591737==    at 0x53EC854: QPen::style() const (in /usr/lib/libQt5Gui.so.5.15.3)
==591737==    by 0x53C6E96: ??? (in /usr/lib/libQt5Gui.so.5.15.3)
==591737==    by 0x52311CC: QTextLine::draw(QPainter*, QPointF const&, QTextLayout::FormatRange const*) const (in /usr/lib/libQt5Gui.so.5.15.3)
==591737==    by 0x53D0724: ??? (in /usr/lib/libQt5Gui.so.5.15.3)
==591737==    by 0x53BD70C: QPainter::drawText(QRectF const&, int, QString const&, QRectF*) (in /usr/lib/libQt5Gui.so.5.15.3)
==591737==    by 0x888F1C: __cpp_closure_14562761572348636077 (in /home/rust/sixtyfps/sixtyfps/target/release/slint-viewer)
==591737==    by 0x386564: <i_slint_backend_qt::qt_window::QtItemRenderer as i_slint_core::item_rendering::ItemRenderer>::draw_text (in /home/rust/sixtyfps/sixtyfps/target/release/slint-viewer)
==591737==    by 0x4BB4EA: i_slint_core::items::TextVTable::render (in /home/rust/sixtyfps/sixtyfps/target/release/slint-viewer)
==591737==    by 0x4CF62E: i_slint_core::item_tree::ItemVisitor_vtable_mod::ItemVisitorVTable::new::visit_item (in /home/rust/sixtyfps/sixtyfps/target/release/slint-viewer)
==591737==    by 0x6CBEF0: i_slint_core::item_tree::visit_item_tree::{{closure}} (in /home/rust/sixtyfps/sixtyfps/target/release/slint-viewer)
==591737==    by 0x69DB4B: slint_interpreter::dynamic_component::visit_children_item (in /home/rust/sixtyfps/sixtyfps/target/release/slint-viewer)
==591737==    by 0x390023: i_slint_core::properties::PropertyTracker<ChangeHandler>::evaluate_as_dependency_root (in /home/rust/sixtyfps/sixtyfps/target/release/slint-viewer)
==591737==  Address 0x244c8948c7894e0d is not stack'd, malloc'd or (recently) free'd

This maigt be because we swap the QPainter, but QPainter is not meant to be moved in memory because QPainterPrivate has a q_ptr pointing back to the QPainter.
Not sure why this doesn't cause any crash or valgrind warning in debug mode but only in release.

Also not setting the clip from QtItemRenderer::render_layer makes the crash disapear.

@ogoffart ogoffart added bug Something isn't working a:backend-qt The Qt backend - including the qt style (mO,bS) labels May 4, 2022
@ogoffart
Copy link
Member Author

ogoffart commented May 5, 2022

( I reported a qttypes::QPainter issue on the qttypes repository woboq/qmetaobject-rs#267 )

ogoffart added a commit that referenced this issue May 5, 2022
ogoffart added a commit that referenced this issue May 5, 2022
ogoffart added a commit that referenced this issue May 5, 2022
ogoffart added a commit that referenced this issue May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:backend-qt The Qt backend - including the qt style (mO,bS) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant