fix ASAN detected stack-use-after-return error

Fixes: https://invent.kde.org/plasma/kwin/-/issues/129
This commit is contained in:
Andrey Butirsky 2022-12-28 15:25:38 +04:00
parent 3dc66923c4
commit 9bbcc506d3
5 changed files with 6 additions and 7 deletions

View file

@ -41,7 +41,7 @@ namespace KWin
KeyboardInputRedirection::KeyboardInputRedirection(InputRedirection *parent)
: QObject(parent)
, m_input(parent)
, m_xkb(new Xkb(parent))
, m_xkb(new Xkb(parent, kwinApp()->followLocale1()))
{
connect(m_xkb.get(), &Xkb::ledsChanged, this, &KeyboardInputRedirection::ledsChanged);
if (waylandServer()) {

View file

@ -380,6 +380,8 @@ private:
inline static Application *kwinApp()
{
Q_ASSERT(qobject_cast<Application *>(QCoreApplication::instance()));
return static_cast<Application *>(QCoreApplication::instance());
}

View file

@ -396,9 +396,6 @@ void TabBoxHandler::show()
d->show();
}
if (d->isHighlightWindows()) {
if (kwinApp()->x11Connection()) {
Xcb::sync();
}
// TODO this should be
// QMetaObject::invokeMethod(this, "initHighlightWindows", Qt::QueuedConnection);
// but we somehow need to cross > 1 event cycle (likely because of queued invocation in the effects)

View file

@ -70,7 +70,7 @@ static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const ch
}
}
Xkb::Xkb(QObject *parent)
Xkb::Xkb(QObject *parent, bool followLocale1)
: QObject(parent)
, m_context(xkb_context_new(XKB_CONTEXT_NO_FLAGS))
, m_keymap(nullptr)
@ -88,7 +88,7 @@ Xkb::Xkb(QObject *parent)
, m_consumedModifiers(Qt::NoModifier)
, m_keysym(XKB_KEY_NoSymbol)
, m_leds()
, m_followLocale1(kwinApp()->followLocale1())
, m_followLocale1(followLocale1)
{
qRegisterMetaType<KWin::LEDs>();
if (!m_context) {

View file

@ -42,7 +42,7 @@ class KWIN_EXPORT Xkb : public QObject
{
Q_OBJECT
public:
Xkb(QObject *parent = nullptr);
Xkb(QObject *parent = nullptr, bool followLocale1 = false);
~Xkb() override;
void setConfig(const KSharedConfigPtr &config);
void setNumLockConfig(const KSharedConfigPtr &config);