From 46df9f83cb64541f7d9ecd34645ef1558ce1c0c6 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 13 Jul 2009 17:53:34 +0200 Subject: Fixed a potential memory leak on XP Calling OpenThemeData directly causes a leak when changing the style as we do not call the corresponding CloseThemeData. Task-number:257916 Reviewed-by:prasanth --- src/gui/styles/qwindowsxpstyle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 2abf3bc..1b8ceae 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -1202,7 +1202,8 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option, if (const QStyleOptionButton *btn = qstyleoption_cast(option)) { MARGINS borderSize; if (widget) { - HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button"); + XPThemeData buttontheme(widget, 0, QLatin1String("Button")); + HTHEME theme = buttontheme.handle(); if (theme) { int stateId; if (!(option->state & State_Enabled)) @@ -3611,7 +3612,8 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt case CT_LineEdit: case CT_ComboBox: { - HTHEME theme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), L"Button"); + XPThemeData buttontheme(widget, 0, QLatin1String("Button")); + HTHEME theme = buttontheme.handle(); MARGINS borderSize; if (theme) { int result = pGetThemeMargins(theme, -- cgit v0.12