1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Don't leak when setting WM_CLASS

This commit is contained in:
nowrep 2013-07-07 15:29:41 +02:00
parent 7d557f5f74
commit 2dcb5efbb1

View File

@ -660,11 +660,10 @@ Display* QzTools::X11Display(const QWidget* widget)
void QzTools::setWmClass(const QString &name, const QWidget* widget)
{
char* namestr = (char*) malloc(name.size() + 1);
strncpy(namestr, name.toUtf8().constData(), name.size() + 1);
QByteArray nameData = name.toUtf8();
XClassHint classHint;
classHint.res_name = namestr;
classHint.res_name = const_cast<char*>(nameData.constData());
classHint.res_class = const_cast<char*>("QupZilla");
XSetClassHint(X11Display(widget), widget->winId(), &classHint);
}