Le 02/11/2011 23:54, Rapha�l Prevost a �crit :
> Here is some old patches I did for KDE 3.5 you may also be interested
> in applying to Trinity, as they fix some annoying issues with
> The first patch fixes a memory leak in dbus-1-qt3, which cause
> knetworkmanager to leak about 4 megs/hour. Basically, the function
> QDBusConnection::sendWithReply() encapsulates the reply with
> QDBusMessage::fromDBusMessage(), the problem is
> dbus_connection_send_with_reply_and_block() already dbus_message_ref()
> the message, and QDBusMessage::fromDBusMessage() do it again. So, when
> the QDBusMessage object is later destroyed, dbus_message_unref() is
> called but the refcount is still at 1... so the message never get
> free'd. I tried removing the _ref() from
> QDBusMessage::fromDBusMessage(), but then knetworkmanager crashes, so
> I guess some messages are actually copied using this function
> somewhere else in the code. Simply using _unref() on the reply in
> QDBusConnection::sendWithReply() before returning looks like the most
> pragmatic solution.
> --- qdbusconnection.cpp 2008-06-06 02:35:56.000000000 +0800
> +++ qdbusconnection.cpp.new 2011-10-30 21:45:06.300981252 +0800
> @@ -285,7 +285,12 @@
> - return QDBusMessage::fromDBusMessage(reply);
> + QDBusMessage mess = QDBusMessage::fromDBusMessage(reply);
> + /* XXX fromDbusMessage do a ref(), avoid leaking */
> + dbus_message_unref(reply);
> + return mess;
> void QDBusConnection::flush() const
> I have another patch to remove the very annoying lag when typing a WPA
> passphrase in the "Add connection" wizard. The code is very bad, it
> computes the hash of the passphrase every time the user inputs a
> character, so typing is slow and laggy even on my i7 CPU. Here is a
> fix to only compute the hash when the QLineEdit lose focus.
> patch -l -p0
> knetworkmanager-connection_setting_wireless_security_widget.h <<'EOF'
> < void slotPSKChanged(const QString&);
> > void slotPSKChanged();
> patch -l -p0
> knetworkmanager-connection_setting_wireless_security_widget.cpp <<'EOF'
> < connect(txtPSK, SIGNAL(textChanged(const QString&)), this,
> SLOT(slotPSKChanged(const QString&)));
> > connect(txtPSK, SIGNAL(lostFocus()), this,
> < WirelessSecurityWPAPSKImpl::slotPSKChanged(const QString& psk)
> > WirelessSecurityWPAPSKImpl::slotPSKChanged()
> > QString psk = txtPSK->text();
> (sorry for the format, I didn't have the source tree at hand so copied
> the last patch from my slackbuild)
I adapted your patches to TDE 3.5.13, they are attached.
Alas, it seems that the dbus part (fix memory leak), when applied, makes
knetworkmanager crash immediatly. at startup (on Fedora).
So I only applied the knetworkmanager part (fix wpa), it does not crash,
but I did not test it (I do not use wifi).