[libkwinxrenderutils] Clean up static blend picture before going down
ClosedPublic

Authored by graesslin on Jun 1 2016, 8:25 AM.

Details

Summary

The method xRenderBlendPicture created a static XRenderPicture on
first usage. To cleanup a XRenderPicture an xcb_connection_t* is needed.
As it's static the cleanup happens on exit handler and at that time Qt
already destroyed the xcb_connection_t*. With a certain chance this will
crash.

To expose the problem a Q_ASSERT(qApp) is added in the destructor of
XRenderPicture. Using xrenderBlendPicture() will hit this assert on
application exit. This is demonstrated by the added auto test.

The actual fix to the problem is moving the static variable out of
the method and introduce a global cleanup method just like the init
method. This is now called from Workspace dtor, so before application
goes down.

CCBUG: 363251

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 4126.Jun 1 2016, 8:25 AM
graesslin retitled this revision from to [libkwinxrenderutils] Clean up static blend picture before going down.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added a reviewer: Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptJun 1 2016, 8:25 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sebas accepted this revision.Jun 13 2016, 12:45 PM
sebas added a reviewer: sebas.
sebas added a subscriber: sebas.

LGTM

This revision is now accepted and ready to land.Jun 13 2016, 12:45 PM
This revision was automatically updated to reflect the committed changes.