Skip to content

Commit

Permalink
Fix some bugs with gatom keyboard grab.
Browse files Browse the repository at this point in the history
- Dangling #keyname_a binding causing crashes after the gatom got
  freed (possibly because its canvas window was closed while the grab
  was still in progress).

- gatom keyboard input being forwarded to the wrong callback when
  switching to the main window after a glist_grabx. This wasn't an issue
  before, but we now use a callback separate from the object's list
  method, to make listbox work properly (which of course expects real
  list input, not just some random key events, in its list method).
  • Loading branch information
agraef committed Aug 15, 2024
1 parent d5700ac commit 3ecb1d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pd/src/g_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -5669,7 +5669,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
// now broadcast key press to key et al. objects
// [email protected] 20200918: only do so if we do not have an object
// that has grabbed the keyboard, such as gatom or iemgui numbox
if (!x || !x->gl_editor || !x->gl_editor->e_grab)
if (!keynamesym_a->s_thing)
{
if (!autorepeat)
{
Expand Down
3 changes: 3 additions & 0 deletions pd/src/g_text.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,9 @@ static void gatom_free(t_gatom *x)
if (*x->a_symfrom->s_name)
pd_unbind(&x->a_text.te_pd,
canvas_realizedollar(x->a_glist, x->a_symfrom));
t_symbol *keynamesym_a = gensym("#keyname_a");
if (keynamesym_a->s_thing)
pd_unbind(&x->a_text.ob_pd, keynamesym_a);
gfxstub_deleteforkey(x);
}

Expand Down

0 comments on commit 3ecb1d1

Please sign in to comment.