summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@pelagicore.com>2019-01-08 16:39:01 +0100
committerRobert Griebl <robert.griebl@pelagicore.com>2019-01-10 14:33:33 +0000
commit806516b5ee3d4427046bde12ad238089b003cbfc (patch)
tree759fe2bfc510a0a31ef0e63ae990c43f7539db82
parent9c4ff31161c2ea09c790ab143a23b3fe997ed4a3 (diff)
Fix crash when starting external (non-AM) Wayland apps
Also worked around a null access in minidesk's main.qml in this case. Change-Id: Ibd1b68f6d976260c9d1d0ef4ca9ffc118dfaeac0 Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--examples/applicationmanager/minidesk/system-ui/main.qml3
-rw-r--r--src/window-lib/waylandwindow.cpp22
-rw-r--r--src/window-lib/waylandwindow.h2
3 files changed, 18 insertions, 9 deletions
diff --git a/examples/applicationmanager/minidesk/system-ui/main.qml b/examples/applicationmanager/minidesk/system-ui/main.qml
index d004ce0a..43265237 100644
--- a/examples/applicationmanager/minidesk/system-ui/main.qml
+++ b/examples/applicationmanager/minidesk/system-ui/main.qml
@@ -94,7 +94,8 @@ Rectangle {
Text {
anchors.horizontalCenter: parent.horizontalCenter
- text: "Decoration: " + model.window.application.name("en")
+ text: "Decoration: " + (model.window.application ? model.window.application.name("en")
+ : 'External Application')
}
MouseArea {
diff --git a/src/window-lib/waylandwindow.cpp b/src/window-lib/waylandwindow.cpp
index 655dbd05..db1d61a5 100644
--- a/src/window-lib/waylandwindow.cpp
+++ b/src/window-lib/waylandwindow.cpp
@@ -141,7 +141,7 @@ QVariantMap WaylandWindow::windowProperties() const
return m_windowProperties;
}
-auto WaylandWindow::contentState() const -> ContentState
+Window::ContentState WaylandWindow::contentState() const
{
if (m_surface)
return m_surface->hasContent() ? SurfaceWithContent : SurfaceNoContent;
@@ -162,12 +162,22 @@ void WaylandWindow::enableOrDisablePing()
void WaylandWindow::onContentStateChanged()
{
- qCDebug(LogGraphics) << this << "of" << application()->id() << "contentState changed to" << contentState();
+ qCDebug(LogGraphics) << this << "of" << applicationId() << "contentState changed to" << contentState();
enableOrDisablePing();
emit contentStateChanged();
}
+QString WaylandWindow::applicationId() const
+{
+ if (application())
+ return application()->id();
+ else if (m_surface && m_surface->client())
+ return qSL("[pid: %1]").arg(m_surface->client()->processId());
+ else
+ return qSL("[external app]");
+}
+
QSize WaylandWindow::size() const
{
return m_surface->size();
@@ -178,12 +188,8 @@ void WaylandWindow::resize(const QSize &newSize)
if (!m_surface)
return;
- AbstractApplication *app = nullptr; // prevent expensive lookup when not printing qDebugs
-
- qCDebug(LogGraphics) << "Sending geometry change request to Wayland client for surface"
- << m_surface << "new:" << newSize << "of"
- << ((app = ApplicationManager::instance()->fromProcessId(m_surface->client()->processId()))
- ? app->id() : QString::fromLatin1("pid: %1").arg(m_surface->client()->processId()));
+ qCDebug(LogGraphics) << this << "of" << applicationId() << "sending resize request for surface"
+ << m_surface << "to" << newSize;
m_surface->sendResizing(newSize);
}
diff --git a/src/window-lib/waylandwindow.h b/src/window-lib/waylandwindow.h
index 3cf80b90..e3fe549e 100644
--- a/src/window-lib/waylandwindow.h
+++ b/src/window-lib/waylandwindow.h
@@ -91,6 +91,8 @@ private slots:
void onContentStateChanged();
private:
+ QString applicationId() const;
+
void enableOrDisablePing();
QTimer *m_pingTimer;
QTimer *m_pongTimer;