mirror of
https://github.com/brl/mutter.git
synced 2024-11-10 07:56:14 -05:00
[x11] Destroy the Window we own when setting a foreign one
When we replace the stage Window using a foreign one we also need to destroy the Window we created, if needed, to avoid leaking resources all around. Fixes bug: http://bugzilla.openedhand.com/show_bug.cgi?id=1750
This commit is contained in:
parent
7963254c23
commit
b190448ed4
@ -781,6 +781,7 @@ typedef struct {
|
||||
ClutterStageX11 *stage_x11;
|
||||
ClutterGeometry geom;
|
||||
Window xwindow;
|
||||
guint destroy_old_xwindow : 1;
|
||||
} ForeignWindowData;
|
||||
|
||||
static void
|
||||
@ -791,6 +792,9 @@ set_foreign_window_callback (ClutterActor *actor,
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "Setting foreign window (0x%x)", (int) fwd->xwindow);
|
||||
|
||||
if (fwd->destroy_old_xwindow)
|
||||
XDestroyWindow (fwd->stage_x11->xdpy, fwd->stage_x11->xwin);
|
||||
|
||||
fwd->stage_x11->xwin = fwd->xwindow;
|
||||
fwd->stage_x11->is_foreign_xwin = TRUE;
|
||||
|
||||
@ -858,6 +862,8 @@ clutter_x11_set_stage_foreign (ClutterStage *stage,
|
||||
|
||||
fwd.stage_x11 = stage_x11;
|
||||
fwd.xwindow = xwindow;
|
||||
/* destroy the old Window, if we own it */
|
||||
fwd.destroy_old_xwindow = stage_x11->is_foreign_xwin ? FALSE : TRUE;
|
||||
fwd.geom.x = x;
|
||||
fwd.geom.y = y;
|
||||
fwd.geom.width = width;
|
||||
|
Loading…
Reference in New Issue
Block a user