Hello,
I am sorry, this is my mistake. Regrettably, for me, the solution you
propose fails to compile. I would propose the slightly convoluted patch
attached to this message. (Does Windows have a problem with something
like "qsrand(time(0))"?)
Best regards, Adam.
Am 11.06.2013 11:13, schrieb Hib Eris:
> Hi again,
>
> On Tue, Jun 11, 2013 at 10:49 AM, Hib Eris <[email protected]> wrote:
>>
>> Building 0.23.2 for windows fails for me with this error message:
>>
>> stress-threads-qt4.cpp: In member function 'virtual void CrazyThread::run()':
>> stress-threads-qt4.cpp:99:49: error: invalid static_cast from type
>> 'Qt::HANDLE {aka void*}' to type 'uint {aka unsigned int}'
>> qsrand(static_cast< uint >(currentThreadId()));
>> ^
>
> This patch makes it compile again for me. Would this be the right way to fix
> it?
>
>
>
> _______________________________________________
> poppler mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/poppler
>
diff --git a/qt4/tests/stress-threads-qt4.cpp b/qt4/tests/stress-threads-qt4.cpp
index 682a73a..7ceb695 100644
--- a/qt4/tests/stress-threads-qt4.cpp
+++ b/qt4/tests/stress-threads-qt4.cpp
@@ -26,11 +26,12 @@ private:
class CrazyThread : public QThread
{
public:
- CrazyThread(Poppler::Document* document, QMutex* annotationMutex, QObject* parent = 0);
+ CrazyThread(uint seed, Poppler::Document* document, QMutex* annotationMutex, QObject* parent = 0);
void run();
private:
+ uint m_seed;
Poppler::Document* m_document;
QMutex* m_annotationMutex;
@@ -86,7 +87,8 @@ void SillyThread::run()
}
}
-CrazyThread::CrazyThread(Poppler::Document* document, QMutex* annotationMutex, QObject* parent) : QThread(parent),
+CrazyThread::CrazyThread(uint seed, Poppler::Document* document, QMutex* annotationMutex, QObject* parent) : QThread(parent),
+ m_seed(seed),
m_document(document),
m_annotationMutex(annotationMutex)
{
@@ -96,7 +98,7 @@ void CrazyThread::run()
{
typedef QScopedPointer< Poppler::Page > PagePointer;
- qsrand(static_cast< uint >(currentThreadId()));
+ qsrand(m_seed);
forever
{
@@ -262,6 +264,8 @@ int main(int argc, char** argv)
const int duration = atoi(argv[1]);
const int sillyCount = atoi(argv[2]);
const int crazyCount = atoi(argv[3]);
+
+ qsrand(time(0));
for(int argi = 4; argi < argc; ++argi)
{
@@ -289,7 +293,7 @@ int main(int argc, char** argv)
for(int i = 0; i < crazyCount; ++i)
{
- (new CrazyThread(document, annotationMutex))->start();
+ (new CrazyThread(qrand(), document, annotationMutex))->start();
}
}
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler