From b5d357d63aeb28b8be62f1a3004a6a7969c7a81e Mon Sep 17 00:00:00 2001 From: Aleksandar Stojiljkovic Date: Mon, 18 Jul 2011 08:46:01 +0300 Subject: Fixes leaking X11 SyncCounter when widgets get open/destroyed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xmeminfo showed leaking memory and unreleased X11 SyncCounter for test application opening and destroying one QWidget. It was not that critical: on 1000+ openings, heap grew ~4MB. This patch fixes the leak. Reviewed-by: Samuel Rødal --- src/gui/kernel/qwidget_x11.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index a3173eb..65d9837 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -2827,6 +2827,12 @@ void QWidgetPrivate::deleteTLSysExtra() { // don't destroy input context here. it will be destroyed in // QWidget::destroy() destroyInputContext(); +#ifndef QT_NO_XSYNC + if (extra && extra->topextra && extra->topextra->syncUpdateCounter) { + XSyncDestroyCounter(X11->display, extra->topextra->syncUpdateCounter); + extra->topextra->syncUpdateCounter = 0; + } +#endif } void QWidgetPrivate::registerDropSite(bool on) -- cgit v0.12