Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-01-02 15:01:46 +0300
committermano-wii <germano.costa@ig.com.br>2019-01-02 15:01:46 +0300
commit945007b32e9a30252216398413bff88c103d8667 (patch)
treed32f5249c0140696368582b7d17066b2e57e20d4 /source/blender/python/gpu/gpu_py_element.c
parentc862c14339e4c3ccf660153a5589ceb3561112d8 (diff)
Fix T59773: Raise exception if the gpu module is used in backgound mode.
Instead of crashing, an error message is displayed if a function of the gpu module is called without a GPU context. Reviewers: brecht, campbellbarton, JacquesLucke, mont29 Subscribers: abdelmatinboulbayam, amir.shehata Differential Revision: https://developer.blender.org/D4143
Diffstat (limited to 'source/blender/python/gpu/gpu_py_element.c')
-rw-r--r--source/blender/python/gpu/gpu_py_element.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/python/gpu/gpu_py_element.c b/source/blender/python/gpu/gpu_py_element.c
index 12027d2e2b8..b996e859bc7 100644
--- a/source/blender/python/gpu/gpu_py_element.c
+++ b/source/blender/python/gpu/gpu_py_element.c
@@ -36,7 +36,7 @@
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
-#include "gpu_py_primitive.h"
+#include "gpu_py.h"
#include "gpu_py_element.h" /* own include */
@@ -61,7 +61,8 @@ static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
static const char *_keywords[] = {"type", "seq", NULL};
static _PyArg_Parser _parser = {"$O&O:IndexBuf.__new__", _keywords, 0};
- if (!_PyArg_ParseTupleAndKeywordsFast(
+ if (!bpygpu_is_initialized() ||
+ !_PyArg_ParseTupleAndKeywordsFast(
args, kwds, &_parser,
bpygpu_ParsePrimType, &params.type_id,
&params.seq))