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:
Diffstat (limited to 'source/blender/blenlib/intern/gsqueue.c')
-rw-r--r--source/blender/blenlib/intern/gsqueue.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c
index fbbc42115d5..e52c573eec7 100644
--- a/source/blender/blenlib/intern/gsqueue.c
+++ b/source/blender/blenlib/intern/gsqueue.c
@@ -81,7 +81,14 @@ void BLI_gsqueue_pop(GSQueue *gq, void *item_r)
}
void BLI_gsqueue_push(GSQueue *gq, void *item)
{
- GSQueueElem *elem= MEM_mallocN(sizeof(*elem)+gq->elem_size, "gqueue_push");
+ GSQueueElem *elem;
+
+ /* compare: prevent events added double in row */
+ if (!BLI_gsqueue_is_empty(gq)) {
+ if(0==memcmp(item, &gq->head[1], gq->elem_size))
+ return;
+ }
+ elem= MEM_mallocN(sizeof(*elem)+gq->elem_size, "gqueue_push");
memcpy(&elem[1], item, gq->elem_size);
elem->next= NULL;