On Fri, Aug 20, 2010 at 06:51:51AM +0000, A. Steinhoff wrote:
> Julien Nadeau <ve...@...> writes:
>
> >
> > On Mon, Aug 16, 2010 at 01:57:47PM +0000, A-Steinhoff wrote:
> [ clip]
> >
> > AG_DriverEvent dev;
> > dev.type = AG_DRIVER_CLOSE;
> > AG_ProcessEvent(NULL, &dev);
> >
> > Now, the test should succeed under SDL drivers.
>
> No it can't succeed:
>
> AG_SDL_GetNextEvent return already a AG_DRIVER_CLOSE event. See the code below
> case SDL_QUIT:
> case SDL_USEREVENT:
> dev->type = AG_DRIVER_CLOSE;
> dev->win = NULL;
> break;
>
> But AG_SDL_ProcessEvent is closing the video and not the driver!
> case AG_DRIVER_CLOSE:
> AGDRIVER_SW_CLASS(drv)->closeVideo(drv);
> agTerminating = 1;
> return (-1);
Yes, you are correct about closeVideo(). I've committed the following
(AG_DriverClose() calls the close() operation and frees the driver
instance structure as well). Now at least according to valgrind on my
machine, there are no more memory leaks between agar init and destroy
(it still reports about 3KB of leaks in libGL.so and getpwuid(), but
nothing in agar itself).
Index: gui/drv_sdl_common.c
===================================================================
--- gui/drv_sdl_common.c (revision 8881)
+++ gui/drv_sdl_common.c (working copy)
@@ -829,7 +829,7 @@
rv = 1;
break;
case AG_DRIVER_CLOSE:
- AGDRIVER_SW_CLASS(drv)->closeVideo(drv);
+ AG_DriverClose(drv);
agTerminating = 1;
return (-1);
case AG_DRIVER_EXPOSE:
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html