On Wed, Dec 31, 2025 at 08:09:21AM +0100, Adam Chyła wrote:
> Hi Dmitry,
> 
> thank you for your reply.
> 
> The 7238123521708ec9 commit will fix this issue, It would be great to have
> it backported to the Trixie.
> 
> I think the issue is with the QXcbVirtualDesktop::dpi function (division by 
> 0),
> which is also used in other places. The other code paths may still be 
> affected.
> 
> Other calls to QXcbVirtualDesktop::dpi:
> 
> qtbase-everywhere-src-5.15.8/src/plugins/platforms/xcb/qxcbscreen.cpp
>   547     } else if (xineramaScreenInfo) {
>   548         m_geometry = QRect(xineramaScreenInfo->x_org, 
> xineramaScreenInfo->y_org,
>   549                            xineramaScreenInfo->width, 
> xineramaScreenInfo->height);
>   550         m_availableGeometry = 
> m_virtualDesktop->availableGeometry(m_geometry);
>   551         m_sizeMillimeters = sizeInMillimeters(m_geometry.size(), 
> m_virtualDesktop->dpi()); // <-----
>   552         if (xineramaScreenIdx > -1)
>   553             m_outputName += QLatin1Char('-') + 
> QString::number(xineramaScreenIdx);
>   554     }
>   555

This block is for the case where RandR is not available, but Xinerama is
available. I think it's quite a rare scenario nowadays. Qt 6 dropped support
for Xinerama completely [1].

[1]: https://code.qt.io/cgit/qt/qtbase.git/commit?id=c91d1fdc100cda88

> ...
>   799     // It can be that physical size is unknown while virtual size
>   800     // is known (probably back-calculated from DPI and resolution),
>   801     // e.g. on VNC or with some hardware.
>   802     if (m_sizeMillimeters.isEmpty())
>   803         m_sizeMillimeters = sizeInMillimeters(geometry.size(), 
> m_virtualDesktop->dpi()); // <-----
> 
> I see that in the newer Qt version, this function is only called from
> the line 803.

Yes, this code remains, but it is also a fallback code, I believe in normal
scenarios m_sizeMillimeters.isEmpty() will be false. In case it causes
problems, it would make sense to report a bug upstream with details.

I will now cherry-pick 7238123521708ec9 and upload it first to unstable, then
(if nobody complains after some time) to stable.

--
Dmitry Shachnev

Attachment: signature.asc
Description: PGP signature

Reply via email to