[MPlayer-cvslog] r22298 - in trunk: Makefile command.c command.h m_property.c m_property.h mp_core.h mplayer.c

Ivo ivop at euronet.nl
Thu Mar 1 23:00:28 CET 2007


On Wednesday 21 February 2007 01:49, uau wrote:
[..]
> +// Not all functions in mplayer.c take the context as an argument yet
> +static MPContext *mpctx = &(MPContext){
> +    .osd_function = OSD_PLAY,
> +    .begin_skip = MP_NOPTS_VALUE,
> +    .play_tree_step = 1,
> +    .global_sub_pos = -1,
> +    .set_of_sub_pos = -1,
> +    .file_format = DEMUXER_TYPE_UNKNOWN,
> +    .last_dvb_step = 1,
> +};

This compiles but does not work with gcc 2.95.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 16224)]
0x08079efb in main (argc=1080797110, argv=0xbf9a2908) at mplayer.c:2335
2335        mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, 
argv);

0x08079eef <main+459>:  call   0x80a1ca0 <m_config_parse_mp_command_line>
0x08079ef4 <main+464>:  mov    %eax,%edx
0x08079ef6 <main+466>:  mov    0x865f184,%eax
0x08079efb <main+471>:  mov    %edx,0xc(%eax)

It's the assignment that segfaults.

It works if you change it to:

Index: mplayer.c
===================================================================
--- mplayer.c   (revision 22402)
+++ mplayer.c   (working copy)
@@ -193,7 +193,7 @@
 //**************************************************************************//
 
 // Not all functions in mplayer.c take the context as an argument yet
-static MPContext *mpctx = &(MPContext){
+static MPContext mpctx_static = {
     .osd_function = OSD_PLAY,
     .begin_skip = MP_NOPTS_VALUE,
     .play_tree_step = 1,
@@ -204,6 +204,7 @@
     .last_dvb_step = 1,
 #endif
 };
+static MPContext *mpctx = &mpctx_static;
 
 int fixed_vo=0;
 

--Ivo



More information about the MPlayer-cvslog mailing list