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
...
  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.

Best regards,
Adam.


W dniu 27.12.2025 o 21:06, Dmitry Shachnev pisze:
Hi Adam, and sorry for the delayed reply!

On Wed, Jun 04, 2025 at 10:20:04PM +0200, Adam Chyła wrote:
The Qt-based applications fail to run. All the apps hang without displaying
anything on the screen, then terminate.

Setting the QT_FONT_DPI environment variable to a sensible default, such as 100,
can be used as a workaround for the issue.

[...]

For this particular case, the platformScreen->logicalDpi() code calls the
QXcbScreen::logicalDpi
function:

qtbase-everywhere-src-5.15.8/src/plugins/platforms/xcb/qxcbscreen.cpp
   720 int QXcbScreen::forcedDpi() const
   721 {
   722     const int forcedDpi = m_virtualDesktop->forcedDpi();
   723     if (forcedDpi > 0)
   724         return forcedDpi;
   725     return 0;
   726 }
   727
   728 QDpi QXcbScreen::logicalDpi() const
   729 {
   730     const int forcedDpi = this->forcedDpi();
   731     if (forcedDpi > 0)
   732         return QDpi(forcedDpi, forcedDpi);
   733
   734     // Fall back to physical virtual desktop DPI, but prevent
   735     // using DPI values lower than 96. This ensuers that connecting
   736     // to e.g. a TV works somewhat predictabilly.
   737     QDpi virtualDesktopPhysicalDPi = m_virtualDesktop->dpi();
   738     return QDpi(std::max(virtualDesktopPhysicalDPi.first, 96.0),
   739                 std::max(virtualDesktopPhysicalDPi.second, 96.0));
   740 }

I believe this commit from Qt 6 should fix this issue, since it removes
the call to dpi():

https://code.qt.io/cgit/qt/qtbase.git/commit?id=7238123521708ec9

Does this change look good to you? If yes, I will upload it to unstable,
and if you want, I can also prepare a fix for Debian stable (Trixie).

--
Dmitry Shachnev

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to