[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] PATCH: sip can't allocate more than 258 objectsM }5
From:       Pieter Nagel <pieter () nagel ! co ! za>
Date:       2000-01-27 14:37:11
[Download RAW message or body]

siplib will freeze in an infinite loop when you try to allocate more
than 258 sip-wrapped objects. To reproduce the bug, try:

	import qt

	foo = []
	for e in range(0, 300):
		foo.append(qt.QObject())

Here's a patch that fixes the problem. No need to recompile PyQt
afterwards.

--- sip-0.10.1/siplib/objmap.cpp.orig	Thu Jan 27 11:59:34 2000
+++ sip-0.10.1/siplib/objmap.cpp	Thu Jan 27 12:00:03 2000
@@ -209,7 +209,7 @@
 
 	size = hash_primes[++primeIdx];
 	hash_array = new HashEntry[size];
-	neverUsed = size;
+	neverUsed += size - old_size;
 
 	for (i = 0; i < old_size; i++)
 		if (!old_entries[i].isFree())


-- 
     ,_
     /_)              /| /
    /   i e t e r    / |/ a g e l






[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic