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

Memory leak in QXcbWindow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.1.0
    • QPA: X11/XCB
    • None
    • Linux/X11

    Description

      When checking our application for memory leaks, we found some memory not freed by the QXcbWindows, e.g.:

      ==1740269== 47 bytes in 5 blocks are still reachable in loss record 27 of 95 
      ==1740269==    at 0x483E77F: malloc (vg_replace_malloc.c:307) 
      ==1740269==    by 0x90456E4: _XlcAddCT (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x9045948: _XlcInitCTInfo (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x904BC83: ??? (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x904B332: ??? (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x904BB78: _XlcCreateLC (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x906CF11: _XlcUtf8Loader (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x905319D: _XOpenLC (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x905347B: XmbTextListToTextProperty (in /usr/lib/libX11.so.6.4.0) 
      ==1740269==    by 0x8F18F4C: QXcbWindow::setWindowTitle(QXcbConnection const*, unsigned int, QString const&) (in /local/ssd/mlangen/build/a3gui.default/usr/lib/libQt6XcbQpa.so.6.1.0) 
      ==1740269==    by 0x8EE326B: QXcbConnection::getQtSelectionOwner() (in /local/ssd/mlangen/build/a3gui.default/usr/lib/libQt6XcbQpa.so.6.1.0) 
      ==1740269==    by 0x8F0F83E: QXcbVirtualDesktop::subscribeToXFixesSelectionNotify() (in /local/ssd/mlangen/build/a3gui.default/usr/lib/libQt6XcbQpa.so.6.1.0)
      

      You can trigger the output by using valgrind with the --leak-check=full --show-leak-kinds=all options on the following program:

      #include <QApplication> 
      #include <QTimer> 
       
      int main(int argc, char **argv) 
      { 
          QApplication app(argc, argv); 
          QTimer::singleShot(1000, qApp, &QApplication::quit); 
          return app.exec(); 
      }

      It looks like the memory allocated with XmbTextListToTextProperty in the method qstringToXTP() in ./qtbase/src/plugins/platforms/xcb/qxcbwindow.cpp is never XFree'd when a QXcbWindow is destroyed.

       

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            mlangen Marc Langenbach
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes