<html>
<body>
  <div id="body" style="background-color:#ffffff;" >
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head" style="border-bottom-width:1px;border-bottom-style:solid;" ><td class="headtd" style="padding:0;padding-top:.2em;" colspan="4">Commit in <b><tt>lxdream/src/drivers/cdrom</tt></b></td></tr>
<tr><td><tt><a href="#file1">sector.c</a></tt></td><td id="added" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ddffdd;" align="right">+23</td><td id="removed" class="headtd2" style="padding-left:.3em;padding-right:.3em; background-color:#ffdddd;" align="right">-13</td><td class="headtd2" style="padding-left:.3em;padding-right:.3em;" nowrap="nowrap">7c40a0f687b3 -> c2d827cbdf37</td></tr>
</table>
<pre class="comment" style="white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;padding:4px;border:1px dashed #000000;background-color:#ffffdd;" >
Close tmpfiles at exit rather than destroying them, to avoid triggering the assertion
due to the source still being referenced
</pre>
<hr /><a name="file1" /><div class="file" style="border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;" >
<span class="pathname" style="font-family:monospace; float:right;" >lxdream/src/drivers/cdrom</span><br />
<div class="fileheader" style="margin-bottom:.5em;" ><big><b>sector.c</b></big> <small id="info" style="color: #888888;" >7c40a0f687b3 -> c2d827cbdf37</small></div>
<pre class="diff" style="margin:0;" ><small id="info" style="color: #888888;" >--- lxdream/src/drivers/cdrom/sector.c
+++ lxdream/src/drivers/cdrom/sector.c
@@ -551,30 +551,40 @@
</small></pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > static GList *tmpfile_open_list = NULL;
 static gboolean tmpfile_atexit_installed = 0; /* TRUE to indicate atexit hook is registered */
 
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+static void tmpfile_sector_close( sector_source_t dev )
+{
+    assert( IS_SECTOR_SOURCE_TYPE(dev,FILE_SECTOR_SOURCE) );
+    tmpfile_sector_source_t fdev = (tmpfile_sector_source_t)dev;
+
+    if( fdev->file.file != NULL ) {
+        fclose( fdev->file.file );
+        fdev->file.file = NULL;
+    }
+    if( fdev->filename != NULL ) {
+        unlink(fdev->filename);
+        g_free((char *)fdev->filename);
+        fdev->filename = NULL;
+    }
+}
+
+
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" > /**
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >- * atexit hook to <span id="removedchars" style="background-color:#ff9999;font-weight:bolder;" >destroy</span> any open tmpfiles - make sure they're deleted.
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+ * atexit hook to <span id="addedchars" style="background-color:#99ff99;font-weight:bolder;" >close</span> any open tmpfiles - make sure they're deleted.
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >  */
 static void tmpfile_atexit_hook(void)
 {
     GList *ptr;
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    while( tmpfile_open_list != NULL ) {
-        sector_source_t source = (sector_source_t)tmpfile_open_list->data;
-        source->destroy(source);
-        assert( tmpfile_open_list == NULL || tmpfile_open_list->data != source );
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    for( ptr = tmpfile_open_list; ptr != NULL; ptr = ptr->next ) {
+        sector_source_t source = (sector_source_t)ptr->data;
+        tmpfile_sector_close(source);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     }
 }
 
 
 static void tmpfile_sector_source_destroy( sector_source_t dev )
 {
</pre><pre id="removed" class="diff" style="margin:0; background-color:#ffdddd;" >-    assert( IS_SECTOR_SOURCE_TYPE(dev,FILE_SECTOR_SOURCE) );
-    tmpfile_sector_source_t fdev = (tmpfile_sector_source_t)dev;
-
-    fclose( fdev->file.file );
-    fdev->file.file = NULL;
-    unlink(fdev->filename);
-    g_free((char *)fdev->filename);
-    tmpfile_open_list = g_list_remove(tmpfile_open_list, fdev);
</pre><pre id="added" class="diff" style="margin:0; background-color:#ddffdd;" >+    tmpfile_sector_close(dev);
+    tmpfile_open_list = g_list_remove(tmpfile_open_list, dev);
</pre><pre id="context" class="diff" style="margin:0; background-color:#eeeeee;" >     default_sector_source_destroy(dev);
 }
 
</pre></div>
<center><small>Chaos Theory</small></center>
</div></body></html>