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

Pressing O crashes RetroArch from git #11686

Closed
audetto opened this issue Dec 12, 2020 · 2 comments
Closed

Pressing O crashes RetroArch from git #11686

audetto opened this issue Dec 12, 2020 · 2 comments

Comments

@audetto
Copy link

audetto commented Dec 12, 2020

Description

While developing my core I noticed that RetroArch crashes when O is pressed

Expected behavior

Record starts

Actual behavior

SegFaults

Steps to reproduce the bug

Press O

Version/Commit

Using retroarch build from github at 625f0d4

Environment information

Ubuntu 20.10

Stack trace:
#0 0x0000000000000000 in ?? ()
#1 0x0000555555627139 in record_driver_init_first (backend=0x5555564cdfa0 <rarch_st+118688>, data=0x5555564cdfa8 <rarch_st+118696>, params=0x7fffffff71a0) at retroarch.c:19429
#2 0x000055555562805a in recording_init (settings=0x7ffff28e1010, p_rarch=0x5555564b1000 <rarch_st>) at retroarch.c:19788
#3 0x000055555561aed5 in command_event (cmd=CMD_EVENT_RECORD_INIT, data=0x0) at retroarch.c:13593
#4 0x0000555555619f6e in command_event (cmd=CMD_EVENT_BSV_RECORDING_TOGGLE, data=0x0) at retroarch.c:13069
#5 0x000055555564fbec in runloop_check_state (p_rarch=0x5555564b1000 <rarch_st>, settings=0x7ffff28e1010, current_time=17857420422) at retroarch.c:37249
#6 0x00005555556503cf in runloop_iterate () at retroarch.c:37440
#7 0x000055555561d911 in rarch_main (argc=4, argv=0x7fffffffdef8, data=0x0) at retroarch.c:14960
#8 0x00005555557d4ca1 in main (argc=4, argv=0x7fffffffdef8) at ui/drivers/qt/ui_qt_application.cpp:151

In particular looking in the debugger I see

https://github.com/libretro/RetroArch/blob/master/retroarch.c

   for (i = 0; record_drivers[i]; i++)
   {
      void *handle = record_drivers[i]->init(params);

      if (!handle)
         continue;

      *backend = record_drivers[i];
      *data = handle;
      return true;
   }

For some reason init is NULL.
It is very likely I did not set up my environment correctly, but a simple check should probably be added, as the same code is checking for null in many other places.

@audetto audetto changed the title Pressing O crashes RetroArch Pressing O crashes RetroArch from git Dec 12, 2020
@audetto
Copy link
Author

audetto commented Dec 12, 2020

With this, it "works"

      if (!record_drivers[i]->init)
         continue;
      void *handle = record_drivers[i]->init(params);

Again, I was not interested in recording, but since I have not yet found how to disable some key bindings (O, F, maybe others), all I care now is that they key is passed to my core without a seg fault.

@LibretroAdmin
Copy link
Contributor

LibretroAdmin commented Sep 2, 2022

Implemented more or less what you suggested, hopefully this makes it a bit more robust:

8c3acb7

Will close this now.

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