<!DOCTYPE html><html><head>
<style type="text/css">body { font-family:'Times New Roman'; font-size:13px}</style>

<style type="text/css">body { font-family:'Times New Roman'; font-size:13px}</style>
</head>
<body><div>Ok I went ahead I tried it myself. It doesn't crash on OSX</div><div><br></div><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex"><div>My bad, I don't know how to produce a stack trace from within the VS debugger. I have it all visually but find no option to save it as a file.</div><div><br></div><div>I added a breakpoint at 
<a href="https://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_atomic_ops.cpp#L56">cpl_atomic_ops.cpp#L56</a> but it didn't stop there after the call to   GDALClose(hDataset); </div><div>Actually when stepping in  it jumps directly from GDALClose() into CPLAtomicCompareAndExchange() but once there (due to crash) I can step back to other functions.</div><div>Sorry if it's not clear.</div><div><br></div><div>Do you have a GMT build with GDAL svn? Could you please try if this crashes for you</div><div><br></div><div>grdmath -Rd -I1 X = lixo.tiff:GTiff<br>grdinfo -R0/20/30/50 lixo.tiff</div><div><br></div><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex"><div dir="ltr">nLockCount should be set by<div><br></div><div><a href="https://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdal_priv.h#L598">https://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdal_priv.h#L598</a><br></div><div><br></div><div><a href="https://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_atomic_ops.cpp#L56">https://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_atomic_ops.cpp#L56</a><br></div><div><br></div><div>which uses InterlockedCompareExchange to change it.</div><div><br></div><div>Can you give the whole stack trace?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 13, 2015 at 6:47 PM, Joaquim Luis <span dir="ltr"><<a href="mailto:jluis@ualg.pt" target="_blank">jluis@ualg.pt</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm having strange crashes in GDAL (SVN) when called via GMT. The crashes occur at a call to<br>
<br>
GDALClose(hDataset);<br>
<br>
Now, this is only occurs when I try to read a sub-region of a grid but those are GMT details.<br>
It doesn't happen to colleagues on OSX but they are using gdal 1.11. Can't say that's the reason but this used to work for me as well on Windows (I should know because I wrote that code).<br>
<br>
I built a GDAL debug and can see that the crash happens in cpl_atomic_ops.cpp<br>
<br>
int CPLAtomicCompareAndExchange(volatile int* ptr, int oldval, int newval)<br>
{<br>
  return (LONG)InterlockedCompareExchange((volatile LONG*)(ptr), (LONG)newval, (LONG)oldval) == (LONG)oldval;<br>
}<br>
<br>
because the 'ptr' is invalid. That function is called by gdalrasterblock.cpp<br>
<br>
GDALRasterBlock::DropLockForRemovalFromStorage()<br>
<br>
        if( CPLAtomicCompareAndExchange(&nLockCount, 0, -1) )<br>
<br>
and the debugger tells me that<br>
<br>
        nLockCount      <Unable to read memory> <br>
<br>
and here I'm lost. Where is nLockCount supposed to be set?<br>
<br>
Thanks<br>
<br>
Joaquim<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">--<div><a href="http://schwehr.org" target="_blank">http://schwehr.org</a></div></div>
</div>
</blockquote><br><br><br></blockquote><br><br><br></body></html>