Commit: 975e56100dcfe7f0c64ebdc59af12c3835744598
Author: Campbell Barton
Date:   Tue Oct 20 03:38:21 2015 +1100
Branches: framebuffer
https://developer.blender.org/rB975e56100dcfe7f0c64ebdc59af12c3835744598

Remove error prefix for use-after-free.

This case is rare enough under regular use,
and Pythons stack-trace to the line is enough to find the error.

===================================================================

M       source/blender/python/intern/gpu_offscreen.c

===================================================================

diff --git a/source/blender/python/intern/gpu_offscreen.c 
b/source/blender/python/intern/gpu_offscreen.c
index 30b6c49..67d2fa1 100644
--- a/source/blender/python/intern/gpu_offscreen.c
+++ b/source/blender/python/intern/gpu_offscreen.c
@@ -64,19 +64,17 @@ typedef struct {
        GPUOffScreen *ofs;
 } BPy_GPUOffScreen;
 
-static int bpy_gpu_offscreen_valid_check(BPy_GPUOffScreen *py_gpu_ofs, const 
char *error_prefix)
+static int bpy_gpu_offscreen_valid_check(BPy_GPUOffScreen *py_gpu_ofs)
 {
        if (UNLIKELY(py_gpu_ofs->ofs == NULL)) {
-               PyErr_Format(PyExc_ReferenceError,
-                            "%.200s: GPU offscreen was freed, no further 
access is valid",
-                            error_prefix);
+               PyErr_SetString(PyExc_ReferenceError, "GPU offscreen was freed, 
no further access is valid");
                return -1;
        }
        return 0;
 }
 
-#define BPY_GPU_OFFSCREEN_CHECK_OBJ(pygpu, errmsg) { \
-       if (UNLIKELY(bpy_gpu_offscreen_valid_check(pygpu, errmsg) == -1)) { \
+#define BPY_GPU_OFFSCREEN_CHECK_OBJ(pygpu) { \
+       if (UNLIKELY(bpy_gpu_offscreen_valid_check(pygpu) == -1)) { \
                return NULL; \
        } \
 } ((void)0)
@@ -87,28 +85,28 @@ static int bpy_gpu_offscreen_valid_check(BPy_GPUOffScreen 
*py_gpu_ofs, const cha
 PyDoc_STRVAR(pygpu_offscreen_width_doc, "Texture width.\n\n:type: i");
 static PyObject *pygpu_offscreen_width_get(BPy_GPUOffScreen *self, void 
*UNUSED(type))
 {
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "width");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
        return PyLong_FromLong(GPU_offscreen_width(self->ofs));
 }
 
 PyDoc_STRVAR(pygpu_offscreen_height_doc, "Texture height.\n\n:type: int");
 static PyObject *pygpu_offscreen_height_get(BPy_GPUOffScreen *self, void 
*UNUSED(type))
 {
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "height");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
        return PyLong_FromLong(GPU_offscreen_height(self->ofs));
 }
 
 PyDoc_STRVAR(pygpu_offscreen_framebuffer_object_doc, "Framebuffer 
object.\n\n:type: int");
 static PyObject *pygpu_offscreen_framebuffer_object_get(BPy_GPUOffScreen 
*self, void *UNUSED(type))
 {
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "framebuffer object");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
        return PyLong_FromLong(GPU_offscreen_fb_object(self->ofs));
 }
 
 PyDoc_STRVAR(pygpu_offscreen_color_object_doc, "Color object.\n\n:type: int");
 static PyObject *pygpu_offscreen_color_object_get(BPy_GPUOffScreen *self, void 
*UNUSED(type))
 {
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "color object");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
        return PyLong_FromLong(GPU_offscreen_color_object(self->ofs));
 }
 
@@ -125,7 +123,7 @@ static PyObject *pygpu_offscreen_bind(BPy_GPUOffScreen 
*self, PyObject *args, Py
        static const char *kwlist[] = {"save", NULL};
        bool save = true;
 
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "bind");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
 
        if (!PyArg_ParseTupleAndKeywords(
                args, kwds, "|O&:bind", (char **)(kwlist),
@@ -151,7 +149,7 @@ static PyObject *pygpu_offscreen_unbind(BPy_GPUOffScreen 
*self, PyObject *args,
        static const char *kwlist[] = {"restore", NULL};
        bool restore = true;
 
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "unbind");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
 
        if (!PyArg_ParseTupleAndKeywords(
                args, kwds, "|O&:unbind", (char **)(kwlist),
@@ -223,7 +221,7 @@ static PyObject 
*pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *a
        GPUFX *fx;
        GPUFXSettings fx_settings;
 
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "draw_view3d");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
 
        if (!PyArg_ParseTupleAndKeywords(
                args, kwds, "OOOO&O&:draw_view3d", (char **)(kwlist),
@@ -266,7 +264,7 @@ PyDoc_STRVAR(pygpu_offscreen_free_doc,
 );
 static PyObject *pygpu_offscreen_free(BPy_GPUOffScreen *self)
 {
-       BPY_GPU_OFFSCREEN_CHECK_OBJ(self, "free");
+       BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
 
        GPU_offscreen_free(self->ofs);
        self->ofs = NULL;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to