Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/server/kernel/wglobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ QW_NAMESPACE::qw_object_basic *WWrapObject::handle() const
bool WWrapObject::isInvalidated() const
{
W_DC(WWrapObject);

Q_ASSERT_X(d->invalidated || handle() != nullptr, Q_FUNC_INFO, "WWrapObject not invalidate in time");

return d->invalidated;
}

Expand Down
9 changes: 7 additions & 2 deletions src/server/protocols/wxwaylandsurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,14 @@ class Q_DECL_HIDDEN WXWaylandSurfacePrivate : public WToplevelSurfacePrivate

void WXWaylandSurfacePrivate::instantRelease()
{
W_Q(WXWaylandSurface);
handle()->set_data(nullptr, nullptr);
if (surface)
surface->removeAttachedData<WXWaylandSurface>();
handle()->disconnect(q);

if (!surface)
return;
surface->safeDeleteLater();
surface = nullptr;
}

void WXWaylandSurfacePrivate::init()
Expand Down
5 changes: 3 additions & 2 deletions src/server/qtquick/private/wsurfaceitem_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "wsurfaceitem.h"
#include "wsurface.h"
#include "wwrappointer.h"

#include <QQuickWindow>
#include <QSGImageNode>
Expand Down Expand Up @@ -63,8 +64,8 @@ class Q_DECL_HIDDEN WSurfaceItemPrivate : public QQuickItemPrivate
}

Q_DECLARE_PUBLIC(WSurfaceItem)
QPointer<WSurface> surface;
QPointer<WToplevelSurface> shellSurface;
WSurface *surface = nullptr;
WWrapPointer<WToplevelSurface> shellSurface;
std::unique_ptr<SurfaceState> surfaceState;
QQuickItem *contentContainer = nullptr;
QQmlComponent *delegate = nullptr;
Expand Down
9 changes: 5 additions & 4 deletions src/server/qtquick/wsurfaceitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class Q_DECL_HIDDEN WSurfaceItemContentPrivate: public QQuickItemPrivate
}

W_DECLARE_PUBLIC(WSurfaceItemContent)
WWrapPointer<WSurface> surface;
WSurface *surface = nullptr;
QRectF bufferSourceBox;
QPoint bufferOffset;
qreal devicePixelRatio = 1.0;
Expand Down Expand Up @@ -592,7 +592,7 @@ WSurfaceItem *WSurfaceItem::fromFocusObject(QObject *focusObject)
WSurface *WSurfaceItem::surface() const
{
Q_D(const WSurfaceItem);
return d->surface.get();
return d->surface;
}

void WSurfaceItem::setSurface(WSurface *surface)
Expand Down Expand Up @@ -900,6 +900,7 @@ void WSurfaceItem::releaseResources()

if (d->surface) {
d->surface->safeDisconnect(this);
d->surface = nullptr;
}

if (!d->surfaceFlags.testFlag(DontCacheLastBuffer)) {
Expand Down Expand Up @@ -936,7 +937,7 @@ bool WSurfaceItem::sendEvent(QInputEvent *event)
if (!d->surface)
return false;

return WSeat::sendEvent(d->surface.get(), this, d->eventItem, event);
return WSeat::sendEvent(d->surface, this, d->eventItem, event);
}

bool WSurfaceItem::doResizeSurface(const QSize &newSize)
Expand Down Expand Up @@ -1220,7 +1221,7 @@ WSurfaceItem *WSurfaceItemPrivate::ensureSubsurfaceItem(WSurface *subsurfaceSurf
{
for (int i = 0; i < subsurfaces.count(); ++i) {
auto surfaceItem = subsurfaces.at(i);
WSurface *surface = surfaceItem->d_func()->surface.get();
WSurface *surface = surfaceItem->d_func()->surface;

if (surface && surface == subsurfaceSurface) {
if (surfaceItem->parent() == parent) {
Expand Down