summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorxndcn <xndchn@gmail.com>2020-12-29 22:29:37 +0800
committerxndcn <xndchn@gmail.com>2020-12-29 23:50:45 +0800
commit34ffdc6e3f5f1548ac2ded575cdd0e391cf9b66a (patch)
tree50b474041b78a60fa37c2eb09754bbb19d844ef0 /tests
parent108933b655160efc4a9795906d01b81f78ddb62c (diff)
downloadgtk+-34ffdc6e3f5f1548ac2ded575cdd0e391cf9b66a.tar.gz
gl: Fix implicit leaking of shader object
According to OpenGL spec, a shader object will only be flagged for deletion unless it has been detached; when a program object is deleted, those shader objects attached to it will be detached but not deleted unless they have already been flagged for deletion. So we shall detach a shader object before it is deleted, and delete it before the program object is deleted best.
Diffstat (limited to 'tests')
-rw-r--r--tests/gtkgears.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/gtkgears.c b/tests/gtkgears.c
index 5f5686c883..2ece67dcf9 100644
--- a/tests/gtkgears.c
+++ b/tests/gtkgears.c
@@ -787,6 +787,8 @@ gtk_gears_realize (GtkWidget *widget)
glLinkProgram(program);
glGetProgramInfoLog(program, sizeof msg, NULL, msg);
g_print ("program info: %s\n", msg);
+ glDetachShader (program, v);
+ glDetachShader (program, f);
glDeleteShader (v);
glDeleteShader (f);