Re: [FFmpeg-devel] [PATCH] lavc/utils: simplify lockmgr

2017-11-29 Thread Timothy Gu
On Sun, Nov 26, 2017 at 8:44 PM Rostislav Pehlivanov 
wrote:

> @@ -103,8 +104,7 @@ static int default_lockmgr_cb(void **arg, enum
> AVLockOp op)
>  case AV_LOCK_DESTROY:
>  if (*mutex)
>  pthread_mutex_destroy(*mutex);
> -av_free(*mutex);
> -avpriv_atomic_ptr_cas(mutex, *mutex, NULL);
> +av_freep(*mutex);
>

av_freep(mutex)? Probably why Michael is seeing the crash.

Timothy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/utils: simplify lockmgr

2017-11-27 Thread Michael Niedermayer
On Mon, Nov 27, 2017 at 04:44:19AM +, Rostislav Pehlivanov wrote:
> Again, totally unneded use of the atomic function to set/NULL a local 
> variable.
> 
> Signed-off-by: Rostislav Pehlivanov 
> ---
>  libavcodec/utils.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

this crashs ffplay

ffplay_g && gdb --args ./ffplay_g tests/data/fate/vsynth1-snow.avi

#0  0x0106f8a3 in av_freep ()
#1  0x00b103c4 in default_lockmgr_cb ()
#2  0x00b13dd3 in av_lockmgr_register ()
#3  0x004ab00d in main ()

if you cant reproduce, say so, and ill rebuild and produce a better
backtrace

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/utils: simplify lockmgr

2017-11-26 Thread Rostislav Pehlivanov
Again, totally unneded use of the atomic function to set/NULL a local variable.

Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/utils.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index de2dcea54d..17388ef637 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -26,7 +26,6 @@
  */
 
 #include "config.h"
-#include "libavutil/atomic.h"
 #include "libavutil/attributes.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
@@ -85,9 +84,11 @@ static int default_lockmgr_cb(void **arg, enum AVLockOp op)
 av_free(tmp);
 return AVERROR(err);
 }
-if (avpriv_atomic_ptr_cas(mutex, NULL, tmp)) {
+if (*mutex) {
 pthread_mutex_destroy(tmp);
 av_free(tmp);
+} else {
+*mutex = tmp;
 }
 }
 
@@ -103,8 +104,7 @@ static int default_lockmgr_cb(void **arg, enum AVLockOp op)
 case AV_LOCK_DESTROY:
 if (*mutex)
 pthread_mutex_destroy(*mutex);
-av_free(*mutex);
-avpriv_atomic_ptr_cas(mutex, *mutex, NULL);
+av_freep(*mutex);
 return 0;
 }
 return 1;
-- 
2.15.0.417.g466bffb3ac

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel