Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-127392

Avoid warning: Ignoring window icon xxx exceeds maximum xcb request length 65535

    XMLWordPrintable

Details

    • Linux/X11
    • 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

        1. some.svg
          6 kB
          Alexander Karaivanov

        Issue Links

          For Gerrit Dashboard: QTBUG-127392
          # Subject Branch Project Status CR V

          Activity

            People

              liaqi Liang Qi
              alexander.karaivanov Alexander Karaivanov
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: