[backends/drm] Fix crash in cleanup of DrmOutput

During cleanup the KWayland::OutputInterface is already destroyed before
we hit the cleanup code of DrmOutput. Thus guard with a QPointer to not
delete twice.
This commit is contained in:
Martin Gräßlin 2015-06-29 12:35:38 +02:00
parent 9af31e8024
commit 4c03115882
2 changed files with 8 additions and 2 deletions

View file

@ -520,6 +520,7 @@ DrmOutput::~DrmOutput()
{
hideCursor();
cleanupBlackBuffer();
delete m_waylandOutput.data();
}
void DrmOutput::hideCursor()
@ -608,7 +609,11 @@ void DrmOutput::init(drmModeConnector *connector)
initEdid(connector);
m_savedCrtc.reset(drmModeGetCrtc(m_backend->fd(), m_crtcId));
blank();
m_waylandOutput.reset(waylandServer()->display()->createOutput());
if (!m_waylandOutput.isNull()) {
delete m_waylandOutput.data();
m_waylandOutput.clear();
}
m_waylandOutput = waylandServer()->display()->createOutput();
if (!m_edid.eisaId.isEmpty()) {
m_waylandOutput->setManufacturer(QString::fromLatin1(m_edid.eisaId));
} else {

View file

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "abstract_backend.h"
#include <QImage>
#include <QPointer>
#include <QSize>
#include <xf86drmMode.h>
@ -155,7 +156,7 @@ private:
};
Edid m_edid;
QScopedPointer<_drmModeCrtc, CrtcCleanup> m_savedCrtc;
QScopedPointer<KWayland::Server::OutputInterface> m_waylandOutput;
QPointer<KWayland::Server::OutputInterface> m_waylandOutput;
};
class DrmBuffer