mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-16 08:52:23 +00:00
[input] Fix input shutdown order
This fixes another segfault on shutdown (not sure just which recent change caused it, but the listener pointer needed clearing) but while fixing the listener issue, I noticed that binding and imt shutdown were in the wrong order with respect to buttons and axes.
This commit is contained in:
parent
1183d44361
commit
9a081b6809
6 changed files with 30 additions and 31 deletions
|
@ -371,7 +371,6 @@ struct IE_event_s;
|
||||||
int IN_Binding_HandleEvent (const struct IE_event_s *ie_event);
|
int IN_Binding_HandleEvent (const struct IE_event_s *ie_event);
|
||||||
void IN_Binding_Activate (void);
|
void IN_Binding_Activate (void);
|
||||||
void IN_Binding_Init (void);
|
void IN_Binding_Init (void);
|
||||||
void IN_Binding_Shutdown (void);
|
|
||||||
struct plitem_s;
|
struct plitem_s;
|
||||||
void IN_Binding_SaveConfig (struct plitem_s *config);
|
void IN_Binding_SaveConfig (struct plitem_s *config);
|
||||||
void IN_Binding_LoadConfig (struct plitem_s *config);
|
void IN_Binding_LoadConfig (struct plitem_s *config);
|
||||||
|
|
|
@ -130,7 +130,6 @@ void IMT_BindButton (imt_t *imt, int button, const char *binding);
|
||||||
bool IMT_ProcessAxis (int axis, int value);
|
bool IMT_ProcessAxis (int axis, int value);
|
||||||
bool IMT_ProcessButton (int button, int state);
|
bool IMT_ProcessButton (int button, int state);
|
||||||
void IMT_Init (void);
|
void IMT_Init (void);
|
||||||
void IMT_Shutdown (void);
|
|
||||||
struct plitem_s;
|
struct plitem_s;
|
||||||
void IMT_SaveConfig (struct plitem_s *config);
|
void IMT_SaveConfig (struct plitem_s *config);
|
||||||
void IMT_SaveAxisConfig (struct plitem_s *axes, int axis_ind, int dev_axis);
|
void IMT_SaveAxisConfig (struct plitem_s *axes, int axis_ind, int dev_axis);
|
||||||
|
|
|
@ -778,19 +778,8 @@ IN_Binding_Activate (void)
|
||||||
IE_Set_Focus (in_binding_handler);
|
IE_Set_Focus (in_binding_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
IN_Binding_Init (void)
|
IN_Binding_Shutdown (void *data)
|
||||||
{
|
|
||||||
in_binding_handler = IE_Add_Handler (in_binding_event_handler, 0);
|
|
||||||
in_keyhelp_handler = IE_Add_Handler (in_keyhelp_event_handler, 0);
|
|
||||||
|
|
||||||
for (bindcmd_t *cmd = in_binding_commands; cmd->name; cmd++) {
|
|
||||||
Cmd_AddCommand (cmd->name, cmd->func, cmd->desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
IN_Binding_Shutdown ()
|
|
||||||
{
|
{
|
||||||
for (in_devbindings_t *db = devbindings_list; db; db = db->next) {
|
for (in_devbindings_t *db = devbindings_list; db; db = db->next) {
|
||||||
clear_connection (db);
|
clear_connection (db);
|
||||||
|
@ -802,6 +791,18 @@ IN_Binding_Shutdown ()
|
||||||
DARRAY_CLEAR (&known_devices);
|
DARRAY_CLEAR (&known_devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
IN_Binding_Init (void)
|
||||||
|
{
|
||||||
|
Sys_RegisterShutdown (IN_Binding_Shutdown, 0);
|
||||||
|
in_binding_handler = IE_Add_Handler (in_binding_event_handler, 0);
|
||||||
|
in_keyhelp_handler = IE_Add_Handler (in_keyhelp_event_handler, 0);
|
||||||
|
|
||||||
|
for (bindcmd_t *cmd = in_binding_commands; cmd->name; cmd++) {
|
||||||
|
Cmd_AddCommand (cmd->name, cmd->func, cmd->desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IN_Binding_SaveConfig (plitem_t *config)
|
IN_Binding_SaveConfig (plitem_t *config)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,7 @@ button_free (void *b, void *data)
|
||||||
if (rb->button->listeners) {
|
if (rb->button->listeners) {
|
||||||
DARRAY_CLEAR (rb->button->listeners);
|
DARRAY_CLEAR (rb->button->listeners);
|
||||||
free (rb->button->listeners);
|
free (rb->button->listeners);
|
||||||
|
rb->button->listeners = 0;
|
||||||
}
|
}
|
||||||
free (rb);
|
free (rb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -532,15 +532,13 @@ IN_shutdown (void *data)
|
||||||
{
|
{
|
||||||
//JOY_Shutdown ();
|
//JOY_Shutdown ();
|
||||||
|
|
||||||
Sys_MaskPrintf (SYS_vid, "IN_Shutdown\n");
|
Sys_MaskPrintf (SYS_vid, "IN_shutdown\n");
|
||||||
for (size_t i = in_drivers.size; i-- > 0; ) {
|
for (size_t i = in_drivers.size; i-- > 0; ) {
|
||||||
in_regdriver_t *rd = &in_drivers.a[i];
|
in_regdriver_t *rd = &in_drivers.a[i];
|
||||||
if (rd->driver.shutdown) {
|
if (rd->driver.shutdown) {
|
||||||
rd->driver.shutdown (rd->data);
|
rd->driver.shutdown (rd->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IN_Binding_Shutdown ();
|
|
||||||
IMT_Shutdown ();
|
|
||||||
|
|
||||||
DARRAY_CLEAR (&in_drivers);
|
DARRAY_CLEAR (&in_drivers);
|
||||||
DARRAY_CLEAR (&in_devices);
|
DARRAY_CLEAR (&in_devices);
|
||||||
|
|
|
@ -936,19 +936,8 @@ static imtcmd_t imt_commands[] = {
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
static void
|
||||||
IMT_Init (void)
|
IMT_Shutdown (void *data)
|
||||||
{
|
|
||||||
binding_mem = new_memsuper ();
|
|
||||||
recipe_tab = Hash_NewTable (61, 0, recipe_free, 0, 0);
|
|
||||||
Hash_SetHashCompare (recipe_tab, recipe_get_hash, recipe_compare);
|
|
||||||
for (imtcmd_t *cmd = imt_commands; cmd->name; cmd++) {
|
|
||||||
Cmd_AddCommand (cmd->name, cmd->func, cmd->desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
IMT_Shutdown (void)
|
|
||||||
{
|
{
|
||||||
imt_drop_all_f ();
|
imt_drop_all_f ();
|
||||||
Hash_DelTable (recipe_tab);
|
Hash_DelTable (recipe_tab);
|
||||||
|
@ -960,6 +949,18 @@ IMT_Shutdown (void)
|
||||||
DARRAY_CLEAR (&in_contexts);
|
DARRAY_CLEAR (&in_contexts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
IMT_Init (void)
|
||||||
|
{
|
||||||
|
Sys_RegisterShutdown (IMT_Shutdown, 0);
|
||||||
|
binding_mem = new_memsuper ();
|
||||||
|
recipe_tab = Hash_NewTable (61, 0, recipe_free, 0, 0);
|
||||||
|
Hash_SetHashCompare (recipe_tab, recipe_get_hash, recipe_compare);
|
||||||
|
for (imtcmd_t *cmd = imt_commands; cmd->name; cmd++) {
|
||||||
|
Cmd_AddCommand (cmd->name, cmd->func, cmd->desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IMT_SaveConfig (plitem_t *config)
|
IMT_SaveConfig (plitem_t *config)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue