Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] Re: (PR#10303) AutoReply: FTWL/SDL: segmentation fault, bu
Home

[Freeciv-Dev] Re: (PR#10303) AutoReply: FTWL/SDL: segmentation fault, bu

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#10303) AutoReply: FTWL/SDL: segmentation fault, buffer overrun likely
From: "Marek \"Baczek\" Baczyński" <imbaczek@xxxxxxxxx>
Date: Fri, 24 Sep 2004 14:02:31 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10303 >

On Fri, 24 Sep 2004 22:54:49 +0200, Marek Baczek Baczyński
<imbaczek@xxxxxxxxx> wrote:

> It's a dangling pointer problem: the widget gets freed, but the
> global(s) still point to it. Will try to fix it.

Fixed. Patch attached.

-- 
{ Marek Baczyński :: UIN 57114871 :: GG 161671 :: JID imbaczek@xxxxxxxxxxxxx  }
{ http://www.vlo.ids.gda.pl/ | imbaczek at poczta fm | http://www.promode.org }
.. .. .. .. ... ... ...... evolve or face extinction ...... ... ... .. .. .. ..

Index: utility/ftwl/widget.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/ftwl/widget.c,v
retrieving revision 1.1
diff -u -r1.1 widget.c
--- utility/ftwl/widget.c       22 Jul 2004 20:00:55 -0000      1.1
+++ utility/ftwl/widget.c       24 Sep 2004 21:01:05 -0000
@@ -440,6 +440,16 @@
   }
   memset(widget, 0x54, sizeof(*widget));
   free(widget);
+  if (selected_widget == widget) {
+    selected_widget = NULL;
+  }
+  /* perhaps paranoid */
+  else if (pressed_widget == widget) {
+    pressed_widget = NULL;
+  }
+  else if (dragged_widget == widget) {
+    dragged_widget = NULL;
+  }
 }
 
 /*************************************************************************

[Prev in Thread] Current Thread [Next in Thread]