Viewing Issue Advanced Details
|ID||Category [?]||Severity [?]||Reproducibility||Date Submitted||Last Update|
|07372||Crash/Freeze||Critical (emulator)||Always||Jul 6, 2019, 22:43||4 days ago|
|Tester||GeorgeMcMullen||View Status||Public||Platform||MAME (Self-compiled)|
|Status [?]||Direction Needed||Driver|
|Version||0.211||Fixed in Version||Build||32-bit|
|Summary||07372: X11 Lightgun routine does not check for valid X11 display, resulting in crash (segmentation fault)|
First bug report, thanks in advance for your patience.
@MrGW reported an issue (https://mametesters.org/view.php?id=7350) with regards to MAME v0.210 crashing immediately on startup, which seemed to be caused by changes in v0.210 which enable X11 and XInput on Linux based systems by default. The workaround is to either compile with X11/XInput explicitly disabled, or start MAME with the option '-lightgunprovider none'. I believe I've found the cause of the issue.
I'm filing a new bug because I'm unable to comment on or reopen the original bug. Also, this is a lower level bug report for the code itself.
- Raspberry Pi (3, 3+, 2, 0)
- Raspbian Stretch or RetroPie 4.4 (based on Raspbian Stretch)
The issue is caused by the Lightgun routine attempting to reference an X11 display when there is none. Thus, this issue is likely to occur on other Linux based platforms where X11 is not being used (e.g. directfb).
The actual crash happens at this line:
That routine should check that m_display is not null before proceeding to XPending(), which evidently also doesn't check that it's been passed a null value.
But this may also be averted by checking that the X11 initialization routine has actually successfully completed as in the following line:
A simple check on the return value of initialize will avert the lightgun routine from completing its own initialization, and subsequently causing the crash.
|Steps To Reproduce||
git pull latest MAME source.
Compile MAME using the standard 'makefile' using the 'make' command
Launch MAME. The UI will just start to show and then it dies with a segmentation fault.
Launch MAME with the following command line options:
You will get output such as the following:
Lightgun: Begin initialization
Unable to connect to X server
Lightgun: End initialization
Joystick: Start initialization
Joystick: End initialization
Searching font Liberation Sans in -. path/s
font Liberation Sans|Regular is not TrueType or BDF, using MAME default
Launching MAME with the following command line options is a workaround, which will allow you to use MAME.
mame -lightgunprovider none
|Affected Sets / Systems|
|There are no relationship linked to this issue.|
Jul 20, 2019, 16:51
|I checked out the history of the input_x11.cpp OSD module and the lines that I mentioned are actually from the original refactoring of the file. As such, knowledge about the inner workings and potential regressions may be hard to come by. Barring anybody else's contribution, I'll do some additional tracing of the code to see if there are any possible hitches and submit a pull request.|
4 days ago
Quick update. I've been working on a pull request and have gotten some feedback.