mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
Fix the memory corruption in a better way.
Thu Mar 30 17:01:12 2006 Søren Sandmann <sandmann@redhat.com> * src/compositor.c (struct MetaCompositor): Fix the memory corruption in a better way.
This commit is contained in:
parent
aaafd14124
commit
eb102ab37f
@ -1,3 +1,8 @@
|
||||
Thu Mar 30 17:01:12 2006 Søren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* src/compositor.c (struct MetaCompositor): Fix the memory
|
||||
corruption in a better way.
|
||||
|
||||
Thu Mar 30 16:38:35 2006 Søren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* src/compositor.c (meta_compositor_begin_move): Fix an illegal write.
|
||||
|
@ -76,8 +76,6 @@ struct MetaCompositor
|
||||
guint debug_updates : 1;
|
||||
|
||||
GList *ignored_damage;
|
||||
|
||||
MoveInfo *move_info;
|
||||
};
|
||||
#endif /* HAVE_COMPOSITE_EXTENSIONS */
|
||||
|
||||
@ -1270,6 +1268,8 @@ get_patch_points (Model *model,
|
||||
}
|
||||
}
|
||||
|
||||
static GList *move_infos;
|
||||
|
||||
static gboolean
|
||||
wobble (gpointer data)
|
||||
{
|
||||
@ -1286,9 +1286,12 @@ wobble (gpointer data)
|
||||
{
|
||||
if (!info->window_destroyed)
|
||||
meta_screen_info_unset_patch (minfo, get_xid (info->window));
|
||||
|
||||
move_infos = g_list_remove (move_infos, info);
|
||||
g_free (info);
|
||||
info->compositor->move_info = NULL;
|
||||
#if 0
|
||||
g_print ("stop wobb\n");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
@ -1339,15 +1342,18 @@ meta_compositor_begin_move (MetaCompositor *compositor,
|
||||
{
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
MetaRectangle rect;
|
||||
MoveInfo *move_info;
|
||||
|
||||
g_print ("begin move\n");
|
||||
|
||||
compositor->move_info = g_new0 (MoveInfo, 1);
|
||||
move_info = g_new0 (MoveInfo, 1);
|
||||
|
||||
compositor->move_info->compositor = compositor;
|
||||
compositor->move_info->last_time = 0.0;
|
||||
compositor->move_info->timer = g_timer_new ();
|
||||
compositor->move_info->window_destroyed = FALSE;
|
||||
move_infos = g_list_prepend (move_infos, move_info);
|
||||
|
||||
move_info->compositor = compositor;
|
||||
move_info->last_time = 0.0;
|
||||
move_info->timer = g_timer_new ();
|
||||
move_info->window_destroyed = FALSE;
|
||||
|
||||
compute_window_rect (window, &rect);
|
||||
|
||||
@ -1358,23 +1364,43 @@ meta_compositor_begin_move (MetaCompositor *compositor,
|
||||
g_print ("grab: %d %d\n", grab_x, grab_y);
|
||||
#endif
|
||||
|
||||
compositor->move_info->model = model_new (&rect, TRUE);
|
||||
compositor->move_info->window = window;
|
||||
compositor->move_info->screen = window->screen;
|
||||
move_info->model = model_new (&rect, TRUE);
|
||||
move_info->window = window;
|
||||
move_info->screen = window->screen;
|
||||
|
||||
model_begin_move (compositor->move_info->model, grab_x, grab_y);
|
||||
model_begin_move (move_info->model, grab_x, grab_y);
|
||||
|
||||
g_idle_add (wobble, compositor->move_info);
|
||||
g_idle_add (wobble, move_info);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
static MoveInfo *
|
||||
find_info (MetaWindow *window)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = move_infos; list != NULL; list = list->next)
|
||||
{
|
||||
MoveInfo *info = list->data;
|
||||
|
||||
if (info->window == window)
|
||||
return info;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
meta_compositor_update_move (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
int x, int y)
|
||||
{
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
model_update_move (compositor->move_info->model, x, y);
|
||||
MoveInfo *move_info = find_info (window);
|
||||
|
||||
model_update_move (move_info->model, x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1383,7 +1409,9 @@ meta_compositor_end_move (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
compositor->move_info->finished = TRUE;
|
||||
MoveInfo *info = find_info (window);
|
||||
|
||||
info->finished = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1393,12 +1421,9 @@ meta_compositor_free_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
#ifdef HAVE_COMPOSITE_EXTENSIONS
|
||||
g_print ("freeing\n");
|
||||
if (compositor->move_info)
|
||||
{
|
||||
g_print ("setting moveinfo to destroyed\n");
|
||||
compositor->move_info->window_destroyed = TRUE;
|
||||
compositor->move_info = NULL;
|
||||
}
|
||||
MoveInfo *info = find_info (window);
|
||||
|
||||
if (info)
|
||||
info->window_destroyed = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user