Skip to content

Commit

Permalink
use wl_list_for_each_safe instead of wl_list_for_each
Browse files Browse the repository at this point in the history
frame_callback may has invalid value if it's freed heap area
is overwritten after wl_resource_destroy

Change-Id: I61d6484857624e9c379ec96e85903e86b55531e0
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
  • Loading branch information
ElvisLee authored and Jørgen Lind committed Sep 12, 2012
1 parent 1d56a6f commit 6c62ffa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compositor/wayland_wrapper/wlsurface.cpp
Expand Up @@ -236,8 +236,8 @@ void Surface::sendFrameCallback()
bool updateNeeded = advanceBufferQueue();

uint time = Compositor::currentTimeMsecs();
struct wl_resource *frame_callback;
wl_list_for_each(frame_callback, &m_frame_callback_list, link) {
struct wl_resource *frame_callback, *next;
wl_list_for_each_safe(frame_callback, next, &m_frame_callback_list, link) {
wl_callback_send_done(frame_callback, time);
wl_resource_destroy(frame_callback);
}
Expand Down

0 comments on commit 6c62ffa

Please sign in to comment.