[vlc-devel] commit: macosx: NSScreen dealloc is not only called at end of execution of course. ( Derk-Jan Hartman )

Pierre d'Herbemont pdherbemont at free.fr
Mon Jun 22 20:07:45 CEST 2009


On Mon, Jun 22, 2009 at 10:59 AM, git version control<git at videolan.org> wrote:
> vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Mon Jun 22 19:55:12 2009 +0200| [b5feb899d6047e2371ce18fe7d73c51fe270e2a1] | committer: Derk-Jan Hartman
>
> macosx: NSScreen dealloc is not only called at end of execution of course.
>
> This fixes the NSScreen crash, which could be accurately reproduced by following the steps in #2880.
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b5feb899d6047e2371ce18fe7d73c51fe270e2a1
> ---
>
>  modules/gui/macosx/misc.m |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
> index fe57179..c9a4c4a 100644
> --- a/modules/gui/macosx/misc.m
> +++ b/modules/gui/macosx/misc.m
> @@ -129,13 +129,14 @@ static NSMutableArray *blackoutWindows = NULL;
>  + (void)load
>  {
>     /* init our fake object attribute */
> -    blackoutWindows = [[NSMutableArray alloc] initWithCapacity:1];
> +    if( !blackoutWindows )
> +        blackoutWindows = [NSMutableArray arrayWithCapacity:1];
>  }

This is wrong. blackoutWindows should be retained. Here it is retained
and autoreleased.

+load is a one shot method triggered at class initialization. Nothing
to do with objects life time.

>  - (void)dealloc
>  {
> +    [blackoutWindows makeObjectsPerformSelector:@selector(close)];
>     [blackoutWindows removeAllObjects];
> -    [blackoutWindows release];

This is wrong, -dealloc shouldn't be implemented here. (I missed that
in jpsaman last commit.)

Pierre.



More information about the vlc-devel mailing list