<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <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 class="moz-cite-prefix">Le 05/12/2021 à 00:49, Simon Eves a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJf0KTQAakXYxzT-2p6_3mraLmPbVaZfmDmadavDcC1P_+DPaQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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" class="gmail_signature"
            data-smartmail="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
                                                          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" moz-do-not-send="true"><img
src="http://www2.omnisci.com/l/298412/2018-09-18/3sqpg/298412/61753/OmniSci_Email_Header2.png"
moz-do-not-send="true"></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"
                                                          moz-do-not-send="true">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 class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>