<div dir="ltr">Yeah, the logic is pretty sketchy now - "if it's a shell surface, do the error checking; otherwise, do nothing" - but I don't understand the code well enough to know if this is the expected behavior.<div><br></div><div>Should the panel just be a shell surface? Then we could require that the popup's parent is a shell surface and simplify the error check.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 6, 2015 at 12:33 PM, Derek Foreman <span dir="ltr"><<a href="mailto:derekf@osg.samsung.com" target="_blank">derekf@osg.samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This bug was introduced in commits da6ecd0cc52 and 24185e2561<br>
<br>
I guess nobody right clicked on the panel for over a month. :)<br>
<br>
I've CC'd Jasper and Jonas in case they haven't noticed this yet...<br>
<span class=""><br>
On 06/04/15 01:52 AM, Dima Ryazanov wrote:<br>
> It looks like the error-checking code assumes the popup's parent is<br>
> a shell surface - but that's not always the case.<br>
><br>
> Signed-off-by: Dima Ryazanov <<a href="mailto:dima@gmail.com">dima@gmail.com</a>><br>
> ---<br>
> desktop-shell/shell.c | 9 +++++----<br>
> 1 file changed, 5 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c<br>
> index f7c928e..0159547 100644<br>
> --- a/desktop-shell/shell.c<br>
> +++ b/desktop-shell/shell.c<br>
> @@ -3392,7 +3392,7 @@ add_popup_grab(struct shell_surface *shsurf,<br>
><br>
> parent = get_shell_surface(shsurf->parent);<br>
> top_surface = get_top_popup(shseat);<br>
> - if (shell_surface_is_xdg_popup(shsurf) &&<br>
> + if (parent && shell_surface_is_xdg_popup(shsurf) &&<br>
<br>
</span>This part broke in da6ecd0cc52<br>
<br>
Your patch definitely stops the crash for me, which is good. :)<br>
<br>
I think this part's ok, but I'm not 100% sure we're still going to send<br>
the new not-top-level-popup error when we're supposed to now...<br>
<span class=""><br>
> ((top_surface == NULL && !shell_surface_is_xdg_surface(parent)) ||<br>
> (top_surface != NULL && parent != top_surface))) {<br>
> wl_resource_post_error(shsurf->owner->resource,<br>
> @@ -4098,12 +4098,13 @@ create_xdg_popup(struct shell_client *owner, void *shell,<br>
> {<br>
> struct shell_surface *shsurf, *parent_shsurf;<br>
><br>
> - /* Verify that we are creating the top most popup when mapping,<br>
> - * as its not until then we know whether it was mapped as most<br>
> + /* Verify that we are creating the topmost popup when mapping,<br>
> + * as it's not until then we know whether it was mapped as most<br>
> * top level or not. */<br>
<br>
</span>The grammar fix-ups look good to me.<br>
<span class=""><br>
> parent_shsurf = get_shell_surface(parent);<br>
> - if (!shell_surface_is_xdg_popup(parent_shsurf) &&<br>
> + if (parent_shsurf &&<br>
<br>
</span>This part broke in 24185e2561...<br>
<br>
I wonder if we should be doing a more comprehensive test here - it looks<br>
like some invalid parent resources could get past this test?<br>
<div class="HOEnZb"><div class="h5"><br>
> + !shell_surface_is_xdg_popup(parent_shsurf) &&<br>
> !shell_surface_is_xdg_surface(parent_shsurf)) {<br>
> wl_resource_post_error(owner->resource,<br>
> XDG_POPUP_ERROR_INVALID_PARENT,<br>
><br>
<br>
<br>
</div></div></blockquote></div><br></div>