desktop-shell: fix the crash while clicking TRANSIENT_INACTIVE window

Submitted by Barry Song on April 15, 2019, 1:52 a.m.

Details

Message ID 20190415015244.13358-1-21cnbao@gmail.com
State New
Headers show
Series "desktop-shell: fix the crash while clicking TRANSIENT_INACTIVE window" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Barry Song April 15, 2019, 1:52 a.m.
From: Barry Song <barry.song@navico.com>

It is pretty easy to replicate this bug by involving a Qt Window with
Qt::WindowTransparentForInput flag.

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    QDialog d1(&w, Qt::WindowTransparentForInput);
    d1.show();

    return a.exec();
}

Click d1 dialog, weston will crash due to NULL==shruf.

Signed-off-by: Barry Song <barry.song@navico.com>
---
 desktop-shell/shell.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 93b1c70b..9473bac1 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2697,11 +2697,16 @@  desktop_surface_move(struct weston_desktop_surface *desktop_surface,
 	struct weston_touch *touch = weston_seat_get_touch(seat);
 	struct shell_surface *shsurf =
 		weston_desktop_surface_get_user_data(desktop_surface);
-	struct weston_surface *surface =
-		weston_desktop_surface_get_surface(shsurf->desktop_surface);
-	struct wl_resource *resource = surface->resource;
+	struct weston_surface *surface;
+	struct wl_resource *resource;
 	struct weston_surface *focus;
 
+	if (!shsurf)
+		return;
+
+	surface = weston_desktop_surface_get_surface(shsurf->desktop_surface);
+	resource = surface->resource;
+
 	if (pointer &&
 	    pointer->focus &&
 	    pointer->button_count > 0 &&

Comments

Hi,

Weston now uses GitLab [1] merge requests for contributions. Can you
resend your patch on GitLab?

Thanks,

[1]: https://gitlab.freedesktop.org/wayland/weston

--
Simon Ser
https://emersion.fr
Simon Ser <contact@emersion.fr> 于2019年4月15日周一 下午5:18写道:
>
> Hi,
>
> Weston now uses GitLab [1] merge requests for contributions. Can you
> resend your patch on GitLab?

sure. do i just need to send it for master, or do we also do a fix for
6.0 and 5.0 release?

>
> Thanks,
>
> [1]: https://gitlab.freedesktop.org/wayland/weston
>
> --
> Simon Ser
> https://emersion.fr

Barry
On Wednesday, April 17, 2019 1:23 PM, Barry Song <21cnbao@gmail.com> wrote:
> Simon Ser contact@emersion.fr 于2019年4月15日周一 下午5:18写道:
>
> > Hi,
> > Weston now uses GitLab 1 merge requests for contributions. Can you
> > resend your patch on GitLab?
>
> sure. do i just need to send it for master, or do we also do a fix for
> 6.0 and 5.0 release?

A merge request for master would be enough. Once the fix is merged we
can discuss about backporting (though we generally don't do it).

Thanks,

Simon
Simon Ser <contact@emersion.fr> 于2019年4月17日周三 下午10:26写道:
>
> On Wednesday, April 17, 2019 1:23 PM, Barry Song <21cnbao@gmail.com> wrote:
> > Simon Ser contact@emersion.fr 于2019年4月15日周一 下午5:18写道:
> >
> > > Hi,
> > > Weston now uses GitLab 1 merge requests for contributions. Can you
> > > resend your patch on GitLab?
> >
> > sure. do i just need to send it for master, or do we also do a fix for
> > 6.0 and 5.0 release?
>
> A merge request for master would be enough. Once the fix is merged we
> can discuss about backporting (though we generally don't do it).

Ongoing on gitlab and Daniel Stone is handling the pull request.

BTW, I am looking forward for some comment from you about:
"weird behavior of transient windows in desktop shell in weston"
https://lists.freedesktop.org/archives/wayland-devel/2019-April/040501.html

>
> Thanks,
>
> Simon

-barry
On Friday, April 26, 2019 12:58 AM, Barry Song <21cnbao@gmail.com> wrote:
> Simon Ser contact@emersion.fr 于2019年4月17日周三 下午10:26写道:
>
> > On Wednesday, April 17, 2019 1:23 PM, Barry Song 21cnbao@gmail.com wrote:
> >
> > > Simon Ser contact@emersion.fr 于2019年4月15日周一 下午5:18写道:
> > >
> > > > Hi,
> > > > Weston now uses GitLab 1 merge requests for contributions. Can you
> > > > resend your patch on GitLab?
> > >
> > > sure. do i just need to send it for master, or do we also do a fix for
> > > 6.0 and 5.0 release?
> >
> > A merge request for master would be enough. Once the fix is merged we
> > can discuss about backporting (though we generally don't do it).
>
> Ongoing on gitlab and Daniel Stone is handling the pull request.
>
> BTW, I am looking forward for some comment from you about:
> "weird behavior of transient windows in desktop shell in weston"
> https://lists.freedesktop.org/archives/wayland-devel/2019-April/040501.html

For bug reports, you can open issues on GitLab. But I think there's
already an issue opened for the bug you describe:

https://gitlab.freedesktop.org/wayland/weston/issues/231

Can you confirm?
Simon Ser <contact@emersion.fr> 于2019年4月26日周五 下午4:57写道:
>
> On Friday, April 26, 2019 12:58 AM, Barry Song <21cnbao@gmail.com> wrote:
> > Simon Ser contact@emersion.fr 于2019年4月17日周三 下午10:26写道:
> >
> > > On Wednesday, April 17, 2019 1:23 PM, Barry Song 21cnbao@gmail.com wrote:
> > >
> > > > Simon Ser contact@emersion.fr 于2019年4月15日周一 下午5:18写道:
> > > >
> > > > > Hi,
> > > > > Weston now uses GitLab 1 merge requests for contributions. Can you
> > > > > resend your patch on GitLab?
> > > >
> > > > sure. do i just need to send it for master, or do we also do a fix for
> > > > 6.0 and 5.0 release?
> > >
> > > A merge request for master would be enough. Once the fix is merged we
> > > can discuss about backporting (though we generally don't do it).
> >
> > Ongoing on gitlab and Daniel Stone is handling the pull request.
> >
> > BTW, I am looking forward for some comment from you about:
> > "weird behavior of transient windows in desktop shell in weston"
> > https://lists.freedesktop.org/archives/wayland-devel/2019-April/040501.html
>
> For bug reports, you can open issues on GitLab. But I think there's
> already an issue opened for the bug you describe:
>
> https://gitlab.freedesktop.org/wayland/weston/issues/231
>
> Can you confirm?

it is basically one same bug as i am reporting.
not only modal dialogs, all transient dialogs have unexpected
behaviour in weston.
Other window managers will keep child windows on top, but weston takes
child dialogs as top-level.

>

-barry