Turn globalonf.drawins into the list of visible drawins
This fixes a crash when the opacity of a not-visible drawin is changed. This happened because we got a PropertyNotify for our own change of _NET_WM_OPACITY and then tried to set the drawin's opacity to this new value. However, the drawin was only reachable through globalconf.drawins and wasn't ref'd in lua. This means that the luaA_object_push() call in property_handle_net_wm_opacity() didn't find the drawin and instead pushed a nil. This then later caused an unprotected lua error in window_set_opacity(). Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
af5e5e8e9c
commit
13364a0181
|
@ -60,12 +60,6 @@ drawin_wipe(drawin_t *w)
|
|||
{
|
||||
/* The drawin must already be unmapped, else it
|
||||
* couldn't be garbage collected -> no unmap needed */
|
||||
foreach(item, globalconf.drawins)
|
||||
if(*item == w)
|
||||
{
|
||||
drawin_array_remove(&globalconf.drawins, item);
|
||||
break;
|
||||
}
|
||||
if(strut_has_value(&w->strut))
|
||||
{
|
||||
screen_t *screen =
|
||||
|
@ -173,8 +167,6 @@ drawin_init(drawin_t *w)
|
|||
/* Set the right properties */
|
||||
ewmh_update_window_type(w->window, window_translate_type(w->type));
|
||||
ewmh_update_strut(w->window, &w->strut);
|
||||
|
||||
drawin_array_append(&globalconf.drawins, w);
|
||||
}
|
||||
|
||||
/** Refresh the window content by copying its pixmap data to its window.
|
||||
|
@ -275,6 +267,20 @@ drawin_map(drawin_t *drawin)
|
|||
client_restore_enterleave_events();
|
||||
/* Stack this drawin correctly */
|
||||
stack_windows();
|
||||
/* Add it to the list of visible drawins */
|
||||
drawin_array_append(&globalconf.drawins, drawin);
|
||||
}
|
||||
|
||||
static void
|
||||
drawin_unmap(drawin_t *drawin)
|
||||
{
|
||||
xcb_unmap_window(globalconf.connection, drawin->window);
|
||||
foreach(item, globalconf.drawins)
|
||||
if(*item == drawin)
|
||||
{
|
||||
drawin_array_remove(&globalconf.drawins, item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Get a drawin by its window.
|
||||
|
@ -316,7 +322,7 @@ drawin_set_visible(lua_State *L, int udx, bool v)
|
|||
/* Active BMA */
|
||||
client_ignore_enterleave_events();
|
||||
/* Unmap window */
|
||||
xcb_unmap_window(globalconf.connection, drawin->window);
|
||||
drawin_unmap(drawin);
|
||||
/* Active BMA */
|
||||
client_restore_enterleave_events();
|
||||
/* unref it */
|
||||
|
|
Loading…
Reference in New Issue