Access violation due to changed usage of pthreads-win32

SF Bug Tracker #119, Creator: Klaus Fischer

Dear libupnp developers,

I have experienced a crash (access violation) when using libupnp on
Windows. The crash is actually located in pthreads-win32 and happens
when repeatedly de-/initializing libupnp on Win32 in the same process
and both libupnp and pthreads-win32 are compiled as static libraries.

So I'm doing this:
- UpnpInit()
- UpnpFinish()
- UpnpInit() <- Crash

I am already in touch with Ross Johnson on the pthreads-win32 mailing
list regarding this issue:

http://sourceware.org/ml/pthreads-win32/2013/msg00020.html

He told me the problem is that the functions
pthread_win32_process_attach/detach_np() should no longer be called
directly, but are invoked automatically now since version 2.9.0 of
pthreads-win32, which has been released approx. 1.5 years ago. Please
refer to above link for in-depth information.

So for proper using of latest pthreads-win32 library, those function
calls should vanish inside libupnp. Could you consider adapting libupnp
in that way? I would really like to use both libraries out-of-the-box
without local modifications, and this issue prevents that.

Best regards,
Klaus
(cherry picked from commit 2211cc14e6)
This commit is contained in:
Marcelo Roberto Jimenez 2013-11-14 15:06:31 -02:00
parent 82cf12b9ed
commit 44af14f387
2 changed files with 36 additions and 8 deletions

View File

@ -357,6 +357,42 @@ Version 1.8.0
Version 1.6.19
*******************************************************************************
2013-11-14 Marcelo Roberto Jimenez <mroberto(at)users.sourceforge.net>
SF Bug Tracker #119, Creator: Klaus Fischer
Access violation due to changed usage of pthreads-win32
Dear libupnp developers,
I have experienced a crash (access violation) when using libupnp on
Windows. The crash is actually located in pthreads-win32 and happens
when repeatedly de-/initializing libupnp on Win32 in the same process
and both libupnp and pthreads-win32 are compiled as static libraries.
So I'm doing this:
- UpnpInit()
- UpnpFinish()
- UpnpInit() <- Crash
I am already in touch with Ross Johnson on the pthreads-win32 mailing
list regarding this issue:
http://sourceware.org/ml/pthreads-win32/2013/msg00020.html
He told me the problem is that the functions
pthread_win32_process_attach/detach_np() should no longer be called
directly, but are invoked automatically now since version 2.9.0 of
pthreads-win32, which has been released approx. 1.5 years ago. Please
refer to above link for in-depth information.
So for proper using of latest pthreads-win32 library, those function
calls should vanish inside libupnp. Could you consider adapting libupnp
in that way? I would really like to use both libraries out-of-the-box
without local modifications, and this issue prevents that.
Best regards,
Klaus
2013-11-08 Peng <howtofly(at)gmail.com>
Fix several minor bugs in soap_device.c

View File

@ -200,10 +200,6 @@ typedef pthread_rwlockattr_t ithread_rwlockattr_t;
static UPNP_INLINE int ithread_initialize_library(void) {
int ret = 0;
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
ret = !pthread_win32_process_attach_np();
#endif
return ret;
}
@ -222,10 +218,6 @@ static UPNP_INLINE int ithread_initialize_library(void) {
static UPNP_INLINE int ithread_cleanup_library(void) {
int ret = 0;
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
ret = !pthread_win32_process_detach_np();
#endif
return ret;
}