Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Oct 2017 13:05:21 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r451381 - in head/devel/sdl20: . files
Message-ID:  <201710061305.v96D5LuU065172@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Fri Oct  6 13:05:21 2017
New Revision: 451381
URL: https://svnweb.freebsd.org/changeset/ports/451381

Log:
  devel/sdl20: crashfix for some consumers after r450461
  
    $ pkg install pioneer
    $ pioneer
    [...]
    ShipType::Init()
    Lua::Init()
    Server agent disabled
  
    Thread 1 received signal SIGSEGV, Segmentation fault.
    0x0000000800cd5d20 in SDL_ConvertSurface_REAL (surface=0x80b374fc0,
        format=0xb4c7e8 <Graphics::pixelFormatRGBA>, flags=0)
        at /usr/ports/devel/sdl20/work/SDL2-2.0.6/src/video/SDL_surface.c:936
    936         copy_flags = surface->map->info.flags;
    (gdb) p surface->map
    $1 = (struct SDL_BlitMap *) 0x0
    (gdb) bt
    #0  0x0000000800cd5d20 in SDL_ConvertSurface_REAL (surface=0x80b374fc0,
        format=0xb4c7e8 <Graphics::pixelFormatRGBA>, flags=0)
        at /usr/ports/devel/sdl20/work/SDL2-2.0.6/src/video/SDL_surface.c:936
    #1  0x0000000800c099d2 in SDL_ConvertSurface (a=0x80b374fc0,
        b=0xb4c7e8 <Graphics::pixelFormatRGBA>, c=0)
        at /usr/ports/devel/sdl20/work/SDL2-2.0.6/src/dynapi/SDL_dynapi_procs.h:492
    #2  0x000000000081cfbb in Graphics::TextureBuilder::PrepareSurface (this=0x7fffffffac50)
        at TextureBuilder.cpp:117
    #3  0x00000000003a0699 in Graphics::TextureBuilder::GetDescriptor (this=0x7fffffffac50)
        at ./graphics/TextureBuilder.h:48
    [...]
  
  PR:		222822
  Obtained from:	upstream
  Submitted by:	lightside@gmx.com

Added:
  head/devel/sdl20/files/patch-src_video_SDL__surface.c   (contents, props changed)
Modified:
  head/devel/sdl20/Makefile   (contents, props changed)

Modified: head/devel/sdl20/Makefile
==============================================================================
--- head/devel/sdl20/Makefile	Fri Oct  6 13:04:57 2017	(r451380)
+++ head/devel/sdl20/Makefile	Fri Oct  6 13:05:21 2017	(r451381)
@@ -2,6 +2,7 @@
 
 PORTNAME=	sdl2
 PORTVERSION=	2.0.6
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	http://www.libsdl.org/release/
 DISTNAME=	SDL2-${PORTVERSION}

Added: head/devel/sdl20/files/patch-src_video_SDL__surface.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/sdl20/files/patch-src_video_SDL__surface.c	Fri Oct  6 13:05:21 2017	(r451381)
@@ -0,0 +1,31 @@
+SDL_FreeSurface deallocates surface->map even if the surface is not yet freed
+https://bugzilla.libsdl.org/show_bug.cgi?id=3852
+
+Memory leak in SDL_FreeSurface (after bug 3852 fix)
+https://bugzilla.libsdl.org/show_bug.cgi?id=3855
+
+--- src/video/SDL_surface.c.orig	2017-09-22 18:51:01 UTC
++++ src/video/SDL_surface.c
+@@ -1198,10 +1198,8 @@ SDL_FreeSurface(SDL_Surface * surface)
+     if (surface->flags & SDL_DONTFREE) {
+         return;
+     }
+-    if (surface->map != NULL) {
+-        SDL_FreeBlitMap(surface->map);
+-        surface->map = NULL;
+-    }
++    SDL_InvalidateMap(surface->map);
++
+     if (--surface->refcount > 0) {
+         return;
+     }
+@@ -1219,6 +1217,9 @@ SDL_FreeSurface(SDL_Surface * surface)
+     if (!(surface->flags & SDL_PREALLOC)) {
+         SDL_free(surface->pixels);
+     }
++    if (surface->map) {
++        SDL_FreeBlitMap(surface->map);
++    }
+     SDL_free(surface);
+ }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710061305.v96D5LuU065172>