Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QtMir shell dies on Mir-on-X when mapping AnonymousShm file #120

Closed
gerboland opened this issue Jan 8, 2018 · 6 comments
Closed

QtMir shell dies on Mir-on-X when mapping AnonymousShm file #120

gerboland opened this issue Jan 8, 2018 · 6 comments

Comments

@gerboland
Copy link
Contributor

With:

  1. latest Mir (0.29 at writing)
  2. QtMir from https://github.com/ubports/qtmir using the "xenial_-_mir29" branch

In a Terminal, we want to test QtMir with Mir-on-X, so run
./demos/qml-demo-shell/qtmir-demo-shell

It fails for me with "Failed to map file: Invalid argument" which is coming from mir::AnonymousShmFile constructor.

@gerboland
Copy link
Contributor Author

I'm still seeing this with Mir trunk and UBPorts on Bionic:
http://pastebin.ubuntu.com/p/gXpsjVZyq8/
I'll look to see why.

@gerboland
Copy link
Contributor Author

Problem is that we were trying to mmap a file of zero length, which you can see from frame 3 of the backtrace.

@gerboland
Copy link
Contributor Author

The issue is how QtMir disables Mir's cursor, it implements mir::graphics::CursorImage to supply an empty image (size 0x0) in a class named "qtmir::NamedCursor". Mir tries to mmap memory for it, and naturally mmap chokes on the 0 size.

What I'm trying to figure out is how to avoid that. Is calling mg::SoftwareCursor::show on a CursorImage which is zero sized wrong? I.e. should it throw on a null cursor?
My workaround is mg::SoftwareCursor::show(CursorImage) checking the size before trying to make a renderable for it, but it doesn't feel right. Opinions welcome

@AlanGriffiths
Copy link
Contributor

It seems to me that disabling Mir's cursor by giving a software cursor an empty image is simply a bad idea. We should support "--cursor null" in addition to "--cursor sofware" and "--cursor auto"

@AlanGriffiths
Copy link
Contributor

@wmww this is the bug we were telling you about last night

@AlanGriffiths AlanGriffiths added this to Wishlst in Mir 0.31 Mar 12, 2018
@AlanGriffiths AlanGriffiths moved this from Wishlst to To do in Mir 0.31 Mar 12, 2018
@AlanGriffiths AlanGriffiths moved this from To do to Wishlst in Mir 0.31 Mar 12, 2018
bors bot added a commit that referenced this issue Mar 14, 2018
244: Software cursor: throw exception for zero sized cursor image r=wmww a=gerboland

Server supplying zero sized cursor image to Mir causes Mir to die with an obscure error message:
"Failed to map file: Invalid argument"
Catch zero sized cursor image and throw with a better error message.

Will help other Mir users when encountering #120
@gerboland
Copy link
Contributor Author

I'd consider this fixed, the ball is in QtMir's court to use a different Mir api to request a hidden cursor.

One (bad) option is setenv("MIR_SERVER_CURSOR", "null", 1)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants