glamor: Fixed one segfault bug when close screen.
move the original glamor_fini to glamor_close_screen. And wrap the CloseScreen with glamor_close_screen, Then we can do some thing before call the underlying CloseScreen(). The root cause is that glamor_fini will be called after the ->CloseScreen(). This may trigger a segmentation fault at glamor_unrealize_glyph_caches() at calling into FreePicture().
This commit is contained in:
parent
0d9e8db8d0
commit
47b6531273
|
@ -203,6 +203,9 @@ glamor_init(ScreenPtr screen)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
glamor_priv->saved_close_screen = screen->CloseScreen;
|
||||
screen->CloseScreen = glamor_close_screen;
|
||||
|
||||
glamor_priv->saved_create_gc = screen->CreateGC;
|
||||
screen->CreateGC = glamor_create_gc;
|
||||
|
||||
|
@ -251,8 +254,8 @@ fail:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
glamor_fini(ScreenPtr screen)
|
||||
Bool
|
||||
glamor_close_screen(int idx, ScreenPtr screen)
|
||||
{
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
#ifdef RENDER
|
||||
|
@ -260,7 +263,7 @@ glamor_fini(ScreenPtr screen)
|
|||
#endif
|
||||
|
||||
glamor_glyphs_fini(screen);
|
||||
|
||||
screen->CloseScreen = glamor_priv->saved_close_screen;
|
||||
screen->CreateGC = glamor_priv->saved_create_gc;
|
||||
screen->CreatePixmap = glamor_priv->saved_create_pixmap;
|
||||
screen->DestroyPixmap = glamor_priv->saved_destroy_pixmap;
|
||||
|
@ -275,4 +278,13 @@ glamor_fini(ScreenPtr screen)
|
|||
ps->Glyphs = glamor_priv->saved_glyphs;
|
||||
}
|
||||
#endif
|
||||
free(glamor_priv);
|
||||
return screen->CloseScreen(idx, screen);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
glamor_fini(ScreenPtr screen)
|
||||
{
|
||||
/* Do nothing currently. */
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ enum shader_in {
|
|||
};
|
||||
|
||||
typedef struct glamor_screen_private {
|
||||
CloseScreenProcPtr saved_close_screen;
|
||||
CreateGCProcPtr saved_create_gc;
|
||||
CreatePixmapProcPtr saved_create_pixmap;
|
||||
DestroyPixmapProcPtr saved_destroy_pixmap;
|
||||
|
@ -282,6 +283,9 @@ t_from_x_coord_y(PixmapPtr pixmap, int y)
|
|||
/* glamor.c */
|
||||
PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
|
||||
|
||||
Bool glamor_close_screen(int idx, ScreenPtr screen);
|
||||
|
||||
|
||||
/* glamor_copyarea.c */
|
||||
RegionPtr
|
||||
glamor_copy_area(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
||||
|
|
Loading…
Reference in New Issue
Block a user