<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] does al_destroy_user_event_source free the event source memory?</title>
		<link>http://www.allegro.cc/forums/view/606663</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 12 Mar 2011 04:54:28 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Does the function al_destroy_user_event_source free the memory occupied by the event source? <a href="http://www.allegro.cc/manual/5/al_destroy_user_event_source">the manual doesn&#39;t say if it does</a>. I assume that it does not, given that the corresponding init function does not allocate memory for the event source.</p><p>I think the word &#39;destroy&#39; is misleading in this case; perhaps it should be changed to &#39;cleanup&#39;, assuming that the function does not free the memory occupied by the event source. Usually, functions are named &#39;create&#39; and &#39;destroy&#39; if they allocate and free memory correspondingly, or &#39;init&#39; and &#39;cleanup&#39; if they don&#39;t manage memory.</p><p>The above, of course, is valid if my assumption about the function not freeing the event source memory.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Fri, 11 Mar 2011 20:15:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It works as you assumed. Feel free to submit a patch to make the documentation clearer - maybe the destruction part for the example in <span class="source-code"><a href="http://www.allegro.cc/manual/al_init_user_event_source"><span class="a">al_init_user_event_source</span></a></span> could be added as example to <span class="source-code"><a href="http://www.allegro.cc/manual/al_destroy_user_event_source"><span class="a">al_destroy_user_event_source</span></a></span>. The free() call in there should remove any doubt as to who is responsible for freeing the memory.</p><p>About the naming I completely agree, destroy always means to free the memory, in the rest of the API. Too bad it can&#39;t be changed for 5.0 any longer, but hopefully for 5.2 (although I&#39;m somewhat afraid we&#39;ll adopt a policy of trying to break as little 5.0 code as possible instead :/).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Fri, 11 Mar 2011 20:48:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Added a sentence. To be fair, if you allocated the memory, Allegro can&#39;t free it. Ok, if we were amateurs we might have made that mistake, but we&#39;re not, are we? <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>We can rename it in 5.2 with a backwards compatibility #define if it&#39;s that important.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Sat, 12 Mar 2011 04:54:28 +0000</pubDate>
	</item>
</rss>
