Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.7.2
-
None
-
-
0ed5d4d67 (dev), 9f0c48c6b (6.8), 21051e384 (6.7), 60e04bf72 (tqtc/lts-6.5), 8dd7e087e (tqtc/lts-6.2)
Description
Using a svg for window icon when run with X11 and device-pixel-ratio 2 or more produces warning:
Ignoring window icon 93367 exceeds maximum xcb request length 65535
Warning is produced by QXcbWindow::setWindowIcon() that in this case:
- as icon.availableSizes() is empty it will it accumulate pixels for pixmaps with sizes [16, 32, 64, 128]
- if total size of accumulated pixel data exceeds the xcb maximum request size it will produce the warning and no icon will be set
With device-pixel-ratio of 2 just for the size of 128 the required amount of pixels is: (128*2)^2 = 65536 which matches xcb max request size.
I would prefer if this warning is avoided as we run our project in a mode where Qt warnings are considered fatal.
Following program can be used to reproduce the problem as long as it is run on linux and device-pixel-ratio is 2 or larger.
#include <QApplication> #include <QWindow> #include <QScreen> #include <iostream> void qt_log_handler(QtMsgType , const QMessageLogContext &, const QString &msg) { std::cerr << msg.toStdString() << "\n"; } int main(int argc, char *argv[]) { QApplication app(argc, argv); QScreen *screen = QGuiApplication::primaryScreen(); std::cerr << "devicePixelRatio: " << screen->devicePixelRatio() << "\n"; qInstallMessageHandler(qt_log_handler); QWindow window; window.setIcon(QIcon(QLatin1String("some.svg"))); window.show(); return app.exec(); }
Size/dpi info for display:
$ DISPLAY=:2 xrandr Screen 0: minimum 32 x 32, current 3456 x 1932, maximum 16384 x 16384 VNC-0 connected 3456x1932+0+0 442mm x 246mm 3456x1932 60.00*+
I'd suggest as a fix: when image_data is accumulated sizes loop skips sizes that would exceed xcb max request size. If none of the sizes was used a warning is produced.
Attachments
Issue Links
- resulted from
-
QTBUG-102628 Application will crash if setWindowsIcon with a big ICON
- Closed
For Gerrit Dashboard: QTBUG-127392 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
582825,1 | xcb: ignore bigger size window icon when size exceeds limit | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: NEW | 0 | 0 |