This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.
The branch, next has been updated
via 527f5f1730cf023e33a67b16721f92dc8bb4822a (commit)
from 7bf8efef5423a45f8cb3ffabeeb2754188460a44 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/527f5f1730cf023e33a67b16721f92dc8bb4822a
commit 527f5f1730cf023e33a67b16721f92dc8bb4822a
Author: Gabriel VLASIU <[email protected]>
Date: Wed Jun 19 15:28:04 2013 +0300
Fix segfault when SwitchPanelImages = None and user press Alt+tab.
diff --git a/WINGs/array.c b/WINGs/array.c
index ae1e17c..390df02 100644
--- a/WINGs/array.c
+++ b/WINGs/array.c
@@ -77,6 +77,9 @@ void WMEmptyArray(WMArray * array)
void WMFreeArray(WMArray * array)
{
+ if (array == NULL)
+ return;
+
WMEmptyArray(array);
wfree(array->items);
wfree(array);
@@ -84,11 +87,17 @@ void WMFreeArray(WMArray * array)
int WMGetArrayItemCount(WMArray * array)
{
+ if (array == NULL)
+ return 0;
+
return array->itemCount;
}
void WMAppendArray(WMArray * array, WMArray * other)
{
+ if (array == NULL || other == NULL)
+ return;
+
if (other->itemCount == 0)
return;
@@ -103,6 +112,9 @@ void WMAppendArray(WMArray * array, WMArray * other)
void WMAddToArray(WMArray * array, void *item)
{
+ if (array == NULL)
+ return;
+
if (array->itemCount >= array->allocSize) {
array->allocSize += RESIZE_INCREMENT;
array->items = wrealloc(array->items, sizeof(void *) *
array->allocSize);
@@ -116,6 +128,9 @@ void WMInsertInArray(WMArray * array, int index, void *item)
{
wassertr(index >= 0 && index <= array->itemCount);
+ if (array == NULL)
+ return;
+
if (array->itemCount >= array->allocSize) {
array->allocSize += RESIZE_INCREMENT;
array->items = wrealloc(array->items, sizeof(void *) *
array->allocSize);
@@ -135,6 +150,9 @@ void *WMReplaceInArray(WMArray * array, int index, void
*item)
wassertrv(index >= 0 && index <= array->itemCount, NULL);
+ if (array == NULL)
+ return NULL;
+
/* is it really useful to perform append if index == array->itemCount ?
-Dan */
if (index == array->itemCount) {
WMAddToArray(array, item);
@@ -151,6 +169,9 @@ int WMDeleteFromArray(WMArray * array, int index)
{
wassertrv(index >= 0 && index < array->itemCount, 0);
+ if (array == NULL)
+ return 0;
+
if (array->destructor) {
array->destructor(array->items[index]);
}
@@ -169,6 +190,9 @@ int WMRemoveFromArrayMatching(WMArray * array,
WMMatchDataProc * match, void *cd
{
int i;
+ if (array == NULL)
+ return 1;
+
if (match != NULL) {
for (i = 0; i < array->itemCount; i++) {
if ((*match) (array->items[i], cdata)) {
@@ -190,7 +214,7 @@ int WMRemoveFromArrayMatching(WMArray * array,
WMMatchDataProc * match, void *cd
void *WMGetFromArray(WMArray * array, int index)
{
- if (index < 0 || index >= array->itemCount)
+ if (index < 0 || array == NULL || index >= array->itemCount)
return NULL;
return array->items[index];
@@ -198,7 +222,7 @@ void *WMGetFromArray(WMArray * array, int index)
void *WMPopFromArray(WMArray * array)
{
- if (array->itemCount <= 0)
+ if (array->itemCount <= 0 || array == NULL)
return NULL;
array->itemCount--;
@@ -210,6 +234,9 @@ int WMFindInArray(WMArray * array, WMMatchDataProc * match,
void *cdata)
{
int i;
+ if (array == NULL)
+ return WANotFound;
+
if (match != NULL) {
for (i = 0; i < array->itemCount; i++) {
if ((*match) (array->items[i], cdata))
@@ -229,6 +256,9 @@ int WMCountInArray(WMArray * array, void *item)
{
int i, count;
+ if (array == NULL)
+ return 0;
+
for (i = 0, count = 0; i < array->itemCount; i++) {
if (array->items[i] == item)
count++;
@@ -239,6 +269,9 @@ int WMCountInArray(WMArray * array, void *item)
void WMSortArray(WMArray * array, WMCompareDataProc * comparer)
{
+ if (array == NULL)
+ return;
+
if (array->itemCount > 1) { /* Don't sort empty or single element
arrays */
qsort(array->items, array->itemCount, sizeof(void *), comparer);
}
@@ -248,6 +281,9 @@ void WMMapArray(WMArray * array, void (*function) (void *,
void *), void *data)
{
int i;
+ if (array == NULL)
+ return;
+
for (i = 0; i < array->itemCount; i++) {
(*function) (array->items[i], data);
}
@@ -257,7 +293,7 @@ WMArray *WMGetSubarrayWithRange(WMArray * array, WMRange
aRange)
{
WMArray *newArray;
- if (aRange.count <= 0)
+ if (aRange.count <= 0 || array == NULL)
return WMCreateArray(0);
if (aRange.position < 0)
@@ -276,7 +312,7 @@ WMArray *WMGetSubarrayWithRange(WMArray * array, WMRange
aRange)
void *WMArrayFirst(WMArray * array, WMArrayIterator * iter)
{
- if (array->itemCount == 0) {
+ if (array == NULL || array->itemCount == 0) {
*iter = WANotFound;
return NULL;
} else {
@@ -287,7 +323,7 @@ void *WMArrayFirst(WMArray * array, WMArrayIterator * iter)
void *WMArrayLast(WMArray * array, WMArrayIterator * iter)
{
- if (array->itemCount == 0) {
+ if (array == NULL || array->itemCount == 0) {
*iter = WANotFound;
return NULL;
} else {
@@ -298,6 +334,11 @@ void *WMArrayLast(WMArray * array, WMArrayIterator * iter)
void *WMArrayNext(WMArray * array, WMArrayIterator * iter)
{
+ if (array == NULL) {
+ *iter = WANotFound;
+ return NULL;
+ }
+
if (*iter >= 0 && *iter < array->itemCount - 1) {
return array->items[++(*iter)];
} else {
@@ -308,6 +349,11 @@ void *WMArrayNext(WMArray * array, WMArrayIterator * iter)
void *WMArrayPrevious(WMArray * array, WMArrayIterator * iter)
{
+ if (array == NULL) {
+ *iter = WANotFound;
+ return NULL;
+ }
+
if (*iter > 0 && *iter < array->itemCount) {
return array->items[--(*iter)];
} else {
-----------------------------------------------------------------------
Summary of changes:
WINGs/array.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 51 insertions(+), 5 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].