<div dir="ltr">OK, thanks for confirming.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 4, 2021 at 3:59 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>You shouldn't throw C++ exceptions, as this is a callback of the
      C API. This will cause all sort of issues, most of the time memory
      leaks, etc.<br>
    </p>
    <div>Le 05/12/2021 à 00:49, Simon Eves a
      écrit :<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">We have a custom Error Handler callback and for a
        while now it was configured to throw an exception if the class
        was Failure or higher.
        <div><br>
        </div>
        <div>Unfortunately, we have found that this causes havoc with
          OpenEx() because the file management state is left bad (e.g.
          the anti-recursion stuff) and GDAL will believe the file is
          open when it isn't, and other such hilarity.</div>
        <div><br>
        </div>
        <div>We have changed this to disable and re-enable the exception
          throw (and just log the error) either side of an OpenEx() but
          I am concerned that there are perhaps other situations where
          throwing may cause similar issues.</div>
        <div><br>
        </div>
        <div>The docs for CPLSetErrorHandler() don't explicitly say
          anything about not throwing in the callback.</div>
        <div><br>
        </div>
        <div>Please advise.</div>
        <div><br>
        </div>
        <div>SE<br clear="all">
          <div><br>
          </div>
          -- <br>
          <div dir="ltr">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>
                    <div dir="ltr">
                      <div>
                        <div dir="ltr">
                          <div style="margin:0px;padding:0px 0px 20px;width:2544px;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium">
                            <div>
                              <div style="font-size:12.8px;margin:8px 0px 0px;padding:0px">
                                <div>
                                  <div dir="ltr"><span><font color="#888888">
                                        <div dir="ltr">
                                          <div dir="ltr">
                                            <div dir="ltr">
                                              <div dir="ltr">
                                                <div dir="ltr">
                                                  <div dir="ltr">
                                                    <div dir="ltr">
                                                      <div dir="ltr">
                                                        <div dir="ltr">
                                                          <div dir="ltr">
                                                          <table style="font-family:Times;width:2544px" cellspacing="0" cellpadding="0" border="0">
                                                          <tbody>
                                                          <tr>
                                                          <td style="vertical-align:top;font-size:0px" align="left">
                                                          <table cellspacing="0" cellpadding="0" border="0">
                                                          <tbody>
                                                          <tr>
                                                          <td style="padding:0px 15px 0px 0px;vertical-align:middle" align="left"><font size="2" face="arial,
                                                          helvetica,
                                                          sans-serif"><a href="http://www.omnisci.com/" target="_blank"><img src="http://www2.omnisci.com/l/298412/2018-09-18/3sqpg/298412/61753/OmniSci_Email_Header2.png"></a><br>
                                                          </font></td>
                                                          <td style="padding:0px 0px 0px 15px;vertical-align:top" align="left">
                                                          <table style="width:215px" cellspacing="0" cellpadding="0" border="0">
                                                          <tbody>
                                                          <tr>
                                                          <td style="vertical-align:top" align="left"><span style="white-space:nowrap;color:rgb(0,0,1)"><span style="color:rgb(14,76,144);font-weight:700"><font size="2" face="arial,
                                                          helvetica,
                                                          sans-serif">Simon
                                                          Eves</font></span></span></td>
                                                          </tr>
                                                          <tr>
                                                          <td style="vertical-align:top" align="left">
                                                          <table cellspacing="0" cellpadding="0" border="0">
                                                          <tbody>
                                                          <tr>
                                                          <td style="vertical-align:top" align="left"><span style="white-space:nowrap;color:rgb(0,0,1)"><font size="2" face="arial,
                                                          helvetica,
                                                          sans-serif">Senior
                                                          Graphics
                                                          Engineer,
                                                          Rendering
                                                          Group<br>
                                                          100 Montgomery
                                                          St (5th
                                                          Floor), San
                                                          Francisco, CA
                                                          94104, USA<br>
                                                          </font></span></td>
                                                          </tr>
                                                          </tbody>
                                                          </table>
                                                          </td>
                                                          </tr>
                                                          <tr>
                                                          <td style="vertical-align:top" align="left">
                                                          <table cellspacing="0" cellpadding="0" border="0">
                                                          <tbody>
                                                          <tr>
                                                          <td style="padding:0px;vertical-align:top" align="left"><br>
                                                          </td>
                                                          <td style="padding:0px;vertical-align:top" align="left"><br>
                                                          </td>
                                                          </tr>
                                                          <tr>
                                                          <td style="padding:0px;vertical-align:top" align="left"><span style="white-space:nowrap;color:rgb(0,0,1)"><font size="2" face="arial,
                                                          helvetica,
                                                          sans-serif">Email: <a href="mailto:simon.eves@omnisci.com" target="_blank">simon.eves@omnisci.com</a> |
                                                          Cell: </font></span></td>
                                                          <td style="padding:0px;vertical-align:top" align="left"><span style="white-space:nowrap;color:rgb(0,0,1)"><font size="2" face="arial,
                                                          helvetica,
                                                          sans-serif">+1
                                                          (415) 902-1996</font></span></td>
                                                          </tr>
                                                          </tbody>
                                                          </table>
                                                          <br>
                                                          </td>
                                                          </tr>
                                                          </tbody>
                                                          </table>
                                                          </td>
                                                          </tr>
                                                          </tbody>
                                                          </table>
                                                          </td>
                                                          </tr>
                                                          </tbody>
                                                          </table>
                                                          <br>
                                                          </div>
                                                        </div>
                                                      </div>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </font></span></div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="margin:0px;padding:0px 0px 20px;width:2544px;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div><div style="font-size:12.8px;margin:8px 0px 0px;padding:0px"><div><div dir="ltr"><span><font color="#888888"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><table cellpadding="0" cellspacing="0" border="0" style="font-family:Times;width:2544px"><tbody><tr><td align="left" style="vertical-align:top;font-size:0px"><table cellpadding="0" cellspacing="0" border="0"><tbody><tr><td align="left" style="padding:0px 15px 0px 0px;vertical-align:middle"><font face="arial, helvetica, sans-serif" size="2"><a href="http://www.omnisci.com/" target="_blank"><img src="http://www2.omnisci.com/l/298412/2018-09-18/3sqpg/298412/61753/OmniSci_Email_Header2.png"></a><br></font></td><td align="left" style="padding:0px 0px 0px 15px;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="width:215px"><tbody><tr><td align="left" style="vertical-align:top"><span style="white-space:nowrap;color:rgb(0,0,1)"><span style="color:rgb(14,76,144);font-weight:700"><font face="arial, helvetica, sans-serif" size="2">Simon Eves</font></span></span></td></tr><tr><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0"><tbody><tr><td align="left" style="vertical-align:top"><span style="white-space:nowrap;color:rgb(0,0,1)"><font face="arial, helvetica, sans-serif" size="2">Senior Graphics Engineer, Rendering Group<br>100 Montgomery St (5th Floor), San Francisco, CA 94104, USA<br></font></span></td></tr></tbody></table></td></tr><tr><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0"><tbody><tr><td align="left" style="padding:0px;vertical-align:top"><br></td><td align="left" style="padding:0px;vertical-align:top"><br></td></tr><tr><td align="left" style="padding:0px;vertical-align:top"><span style="white-space:nowrap;color:rgb(0,0,1)"><font face="arial, helvetica, sans-serif" size="2">Email: <a href="mailto:simon.eves@omnisci.com" target="_blank">simon.eves@omnisci.com</a> | Cell: </font></span></td><td align="left" style="padding:0px;vertical-align:top"><span style="white-space:nowrap;color:rgb(0,0,1)"><font face="arial, helvetica, sans-serif" size="2">+1 (415) 902-1996</font></span></td></tr></tbody></table><br></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><br></div></div></div></div></div></div></div></div></div></div></font></span></div><div></div></div></div><div></div></div></div></div></div></div></div></div></div></div></div>