[MPlayer-users] -vo macosx. Bad Memory
thyme pancakes
newsbought at hotmail.com
Sat Jan 20 16:25:37 CET 2007
So I've been fiddling with this and here is what I found. In
libvo/vo_macosx.m, in the uninit function, the program crashes when you
close the video window. This is because the NSAutoRelease pool is not being
released properly.
This doesn't happen when you run the program from the macosx gui. (I've
compiled my on build to work with the gui with debug messages to show the
flow of execution. The logs indicate normal program termination) I believe
this is because when is invoked by the gui, mplayer makes a connection with
the gui and creates objects in the autoreleasepool memory based on that. We
communicate through the mplayerosxProxy which is initialized in config (line
169) through a call to NSConnection's
rootProxyForConnectionWithRegisteredName method. But we don't check if that
fails, as it would when being invoked from a command line.
So to prevent mplayer from crashing on the command line I've put a check to
see whether mplayerosxProxy isn't nil before releasing a possible
unallocated autorelease pool. It works.
---------------------------------------------------
static void uninit(void)
{
if(shared_buffer)
{
[mplayerosxProxy stop];
if (shmdt(image_data) == -1)
mp_msg(MSGT_VO, MSGL_FATAL, "uninit: shmdt failed\n");
if (shmctl(shm_id, IPC_RMID, &shm_desc) == -1)
mp_msg(MSGT_VO, MSGL_FATAL, "uninit: shmctl failed\n");
}
SetSystemUIMode( kUIModeNormal, 0);
CGDisplayShowCursor(kCGDirectMainDisplay);
if(mplayerosxProxy != nil)/*If we are not invoking mplayer from the command
line*/
{
[autoreleasepool release];
}
}
-----------------------------------------------------
Someone who knows this code better than I should give a full critique and a
better explanation. I'm really half guessing here.
>From: "thyme pancakes" <newsbought at hotmail.com>
>Reply-To: "MPlayer usage questions, feature requests, bug reports"
><mplayer-users at mplayerhq.hu>
>To: mplayer-users at mplayerhq.hu
>Subject: [MPlayer-users] -vo macosx. Bad Memory
>Date: Fri, 19 Jan 2007 15:30:21 +0000
>
>There was a problem with -vo macosx. libvo/vo_macos.m blows out when the
>uninit function tries to release the autoreleasepool. It's not because
>mplayer is not NSThread safe (I tried doing a quick detach thread before
>the autoreleasepool alloc; didn't help.) Since this memory is supposed to b
>safe memory, released automatically by the main thread (which may be the
>reason the program dies when uninit tries to do something already done) I
>just comment out the line and there are no more crashes or harm being done.
>From vo_macosx.m, line 254.
>
>---------------------------------------------------------
>/* [autoreleasepool release];*/
>//The above caused a crash. Must find a better place to do this or not do
>it at all.
>---------------------------------------------------------
>
>Of course you could avoid all these problems by setting -vo quartz which is
>rock solid. However I am stupid in unusual ways and I forgot about that. Do
>what suits you best.
>
>Cheers.
>
>_________________________________________________________________
>Windows Live Spaces: share your New Year pictures!
>http://discoverspaces.live.com/?loc=en-CA
>
>_______________________________________________
>MPlayer-users mailing list
>MPlayer-users at mplayerhq.hu
>http://lists.mplayerhq.hu/mailman/listinfo/mplayer-users
_________________________________________________________________
Windows Live Spaces: share your New Year pictures!
http://discoverspaces.live.com/?loc=en-CA
More information about the MPlayer-users
mailing list