https://bugs.kde.org/show_bug.cgi?id=478556

--- Comment #73 from vm <vyacheslav.mayo...@gmail.com> ---
After a lot of debugging i think i've found at least a better workaround.

Workaround: 

Quite simple - disable ALL effects in "Window Open/Close Animation" group.

Details:

It looks like when any of these effect are enabled KWin starts leaking Window
instances, as they sometimes not getting deleted. 

In IDEA every button (such as Run/Debug, Settings, left panel buttons) - has a
tooltip.
When you hover over any of these IDEA button it creates new X window to display
a tooltip. 
When mouse leaves that button - tooltip window is destroyed.
KWin tries to animate destruction of that tooltip (...yeah tooltip death
animation...)
And sometimes it causes that Window instances (previously used by tooltips) are
never be deleted (a lot of X11Window instances holding m_client = 0x0), because
m_refCount counter never reaches zero.
Why and where it leaks exactly i'm still don't understand, but the problem
somewhere in this effects implementation.
A few moments later this leaked Window instances start causing a lot of
stacking issues.

Look:

https://youtu.be/1jiKEP-MJQQ

What i've done - added simple logging to Workspace::updateStackingOrder (and
some quite simple helpers - such as refCount() to Window.h for debugging
reasons):

    void Workspace::updateStackingOrder(bool propagate_new_windows)
    {
        if (m_blockStackingUpdates > 0) {
            if (propagate_new_windows) {
                m_blockedPropagatingNewWindows = true;
            }
            return;
        }
        QList<Window *> new_stacking_order = constrainedStackingOrder();
        bool changed = (force_restacking || new_stacking_order !=
stacking_order);
        force_restacking = false;
        stacking_order = new_stacking_order;
        if (changed || propagate_new_windows) {
            propagateWindows(propagate_new_windows);

            for (int i = 0; i < stacking_order.size(); ++i) {
                stacking_order[i]->setStackingOrder(i);
            }

            Workspace::debugStacking("Stacking order changed!!!",
stacking_order); // <----------------------------------

            Q_EMIT stackingOrderChanged();

            if (m_activeWindow) {
                m_activeWindow->updateMouseGrab();
            }
        }
    }

    void Workspace::debugStacking(const char* prefix, const QList<Window*>&
stacking) {
        QString debugString;
        for (Window* w: stacking) {
            X11Window* x11w = static_cast<X11Window*>(w);
            debugString.append(QString("  instance = 0x%1 refCount = %2 window
= 0x%3 desc = %4\n")
                .arg(reinterpret_cast<uintptr_t>(x11w), 0, 16)
                .arg(x11w->refCount())
                .arg(x11w->window(), 0, 16)
                .arg(x11w->windowDesc()));
        }
        qDebug("%s!!!\n%s", prefix, qUtf8Printable(debugString));
    }

Also i've launched gdb to get backtraces with this commands:

    gdb ./kwin_x11

    break window.cpp:113
    commands
    silent
    bt 6
    continue
    end

    break window.cpp:118
    commands
    silent
    bt 6
    continue
    end

    run --replace`

But without success as i didn't find a real reason - looks like Window
references are hold by EffectWindowDeletedRef, but why... 

With all this in mind:

What i clearly know - KWin Window leaking - doesn't look like IDEA problem. 
I think this is also reproducible with ANY software which can create/delete
windows as fast as IDEA does.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to