summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-02 15:30:16 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-02 15:30:16 (GMT)
commitf2d1d7a2f8a6b4a19f7ef7c91786845f2a987b59 (patch)
tree58d31640d47d0b35a0285ede997dd0f2a93d2774
parent95b17fbe91eb3b1b0fcac92d8a8934769e4cd847 (diff)
parentbb6d0f75d4a5d3dadb5e0134aa0270bcab61f205 (diff)
downloadQt-f2d1d7a2f8a6b4a19f7ef7c91786845f2a987b59.zip
Qt-f2d1d7a2f8a6b4a19f7ef7c91786845f2a987b59.tar.gz
Qt-f2d1d7a2f8a6b4a19f7ef7c91786845f2a987b59.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fix for QTBUG-17035 Carefull free the data from XGetWindowProperty on X11. Fixes memory leaks in QX11Embed
-rw-r--r--src/gui/kernel/qwidget_x11.cpp4
-rw-r--r--src/gui/kernel/qx11embed_x11.cpp7
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp6
3 files changed, 11 insertions, 6 deletions
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 9893478..28eb3f0 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -444,6 +444,7 @@ static QVector<Atom> getNetWmState(QWidget *w)
&& actualType == XA_ATOM && actualFormat == 32) {
returnValue.resize(bytesLeft / 4);
XFree((char*) propertyData);
+ propertyData = 0;
// fetch all data
if (XGetWindowProperty(X11->display, w->internalWinId(), ATOM(_NET_WM_STATE), 0,
@@ -458,7 +459,8 @@ static QVector<Atom> getNetWmState(QWidget *w)
if (!returnValue.isEmpty()) {
memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom));
}
- XFree((char*) propertyData);
+ if (propertyData)
+ XFree((char*) propertyData);
}
return returnValue;
diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp
index aba42f2..710f607 100644
--- a/src/gui/kernel/qx11embed_x11.cpp
+++ b/src/gui/kernel/qx11embed_x11.cpp
@@ -415,8 +415,9 @@ static Bool functor(Display *display, XEvent *event, XPointer arg)
status = XGetWindowProperty(display, data->id, ATOM(WM_STATE), 0, 2, False, ATOM(WM_STATE),
&ret, &format, &nitems, &after, &retval );
if (status == Success && ret == ATOM(WM_STATE) && format == 32 && nitems > 0) {
- long *state = (long *)retval;
- if (state[0] == WithdrawnState) {
+ long state = *(long *)retval;
+ XFree(retval);
+ if (state == WithdrawnState) {
data->clearedWmState = true;
return true;
}
@@ -833,6 +834,8 @@ bool QX11EmbedWidget::x11Event(XEvent *event)
XUnmapWindow(x11Info().display(), internalWinId());
}
}
+ if (prop_return)
+ XFree(prop_return);
}
}
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index 6d578d3..af5d85e 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -125,9 +125,6 @@ static QString get_network_interface();
void QNetworkSessionPrivateImpl::iapStateChanged(const QString& iapid, uint icd_connection_state)
{
- if ((publicConfig.type() == QNetworkConfiguration::UserChoice) && opened) {
- updateIdentifier(iapid);
- }
if (((publicConfig.type() == QNetworkConfiguration::UserChoice) &&
(activeConfig.identifier() == iapid)) ||
@@ -149,6 +146,9 @@ void QNetworkSessionPrivateImpl::iapStateChanged(const QString& iapid, uint icd_
break;
}
}
+ if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
+ updateIdentifier(iapid);
+ }
}
void QNetworkSessionPrivateImpl::cleanupSession(void)