This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/46455] resource leaks due to missing destructors for mutexes and condvars


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46455

--- Comment #24 from Zouzou <internet at 123gen dot com> 2010-11-16 22:29:35 UTC ---
(In reply to comment #23)
> Created attachment 22424 [details]
> add destructors in <ext/concurrence.h>
> here's another patch, this one uses SFINAE to select an appropriate overload
> based on the type of __gthread_recursive_mutex_t and if necessary extracts a
> __gthread_mutex_t from it to pass to __gthread_mutex_destroy
> this will be wrong if a recursive mutex type needs more cleanup than just
> destroying its non-recursive mutex, though I don't think that's a problem for
> any current systems supported by gthreads.
> could be improved upon by disabling the third _S_destroy overload when
> recursive_mutex_type is not the same as mutex_type, but it's ugly enough
> already.
> Zouzou, could you test this on mingw? thanks

same compiler error as for the previous patch:
In file included from
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/memory:78:0,
                 from test.cpp:15:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/concurrence.h: In static
member function 'static int __gnu_cxx::__recursive_mutex::_S_destroy(_Rm*, ...)
[with _Rm = __gthread_recursive_mutex_t]':
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/concurrence.h:224:22:  
instantiated from here
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/concurrence.h:284:44:
error: cannot convert '__gthread_recursive_mutex_t*' to '__gthread_mutex_t*'
for argument '1' to 'void __gthread_mutex_destroy(__gthread_mutex_t*)'

(my line numbers are off by 2 compared to your patches.)

apparently the 1st overload doesn't match so it falls back to the 3rd one.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]