[Mesa-dev] [PATCH] radeonsi: Fix crash when destroying si_screen
Tom Stellard
thomas.stellard at amd.com
Wed Jan 7 09:56:39 PST 2015
We need to dispose the cached LLVMTargetMachine before calling
r600_destory_common_screen(), because this function frees the si_screen
object which invalidates LLVMTargetMachine pointer.
https://bugs.freedesktop.org/show_bug.cgi?id=88170
---
src/gallium/drivers/radeonsi/si_pipe.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 38bff31..e3f8fcf 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -424,11 +424,13 @@ static void si_destroy_screen(struct pipe_screen* pscreen)
if (!sscreen->b.ws->unref(sscreen->b.ws))
return;
- r600_destroy_common_screen(&sscreen->b);
-
#if HAVE_LLVM >= 0x0306
+ // r600_destroy_common_screen() frees sscreen, so we need to make
+ // sure to dispose the TargetMachine before we call it.
LLVMDisposeTargetMachine(sscreen->tm);
#endif
+
+ r600_destroy_common_screen(&sscreen->b);
}
#define SI_TILE_MODE_COLOR_2D_8BPP 14
--
1.9.0
More information about the mesa-dev
mailing list