mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Don't leak when setting WM_CLASS
This commit is contained in:
parent
7d557f5f74
commit
2dcb5efbb1
|
@ -660,11 +660,10 @@ Display* QzTools::X11Display(const QWidget* widget)
|
||||||
|
|
||||||
void QzTools::setWmClass(const QString &name, const QWidget* widget)
|
void QzTools::setWmClass(const QString &name, const QWidget* widget)
|
||||||
{
|
{
|
||||||
char* namestr = (char*) malloc(name.size() + 1);
|
QByteArray nameData = name.toUtf8();
|
||||||
strncpy(namestr, name.toUtf8().constData(), name.size() + 1);
|
|
||||||
|
|
||||||
XClassHint classHint;
|
XClassHint classHint;
|
||||||
classHint.res_name = namestr;
|
classHint.res_name = const_cast<char*>(nameData.constData());
|
||||||
classHint.res_class = const_cast<char*>("QupZilla");
|
classHint.res_class = const_cast<char*>("QupZilla");
|
||||||
XSetClassHint(X11Display(widget), widget->winId(), &classHint);
|
XSetClassHint(X11Display(widget), widget->winId(), &classHint);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user