<div dir="ltr"><div dir="ltr"><div>Hi Giulio,</div><div><br></div><div>add the flags methods to tell your algorithm is not thread-safe. From the documentation :<br></div><div><a href="https://docs.qgis.org/3.16/en/docs/user_manual/processing/scripts.html#flags">https://docs.qgis.org/3.16/en/docs/user_manual/processing/scripts.html#flags</a></div></div><div><br></div><div>If your algorithm is regularly crashing, you are probably using API
calls which are not safe to do in a background thread.
Try returning the <b>QgsProcessingAlgorithm.FlagNoThreading flag from
your algorithm’s flags() method</b> to force Processing to run your
algorithm in the main thread instead.</div><div><br></div><div>I just tested and it works.</div><div><br></div><div>Regards,<br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 22 janv. 2021 à 14:56, Giulio Fattori <<a href="mailto:giulio.fattori@tin.it">giulio.fattori@tin.it</a>> a écrit :<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><font size="-1"><font face="Century Gothic">Hello,<br>
          i'm developing a QGIS plugin algorithm that composes a print
          layout.<br>
          The attached code works but the map window appears in the
          composer with the word "Rendering map".<br>
          and I get these messages:<br>
          <br>
          WARNING    QObject::connect: Cannot queue arguments of type
          'QItemSelection'<br>
                       (Make sure 'QItemSelection' is registered using
          qRegisterMetaType().)<br>
          WARNING    QObject::connect: Cannot queue arguments of type
          'QItemSelection'<br>
                       (Make sure 'QItemSelection' is registered using
          qRegisterMetaType().)<br>
          WARNING    QObject::connect: Cannot queue arguments of type
          'QItemSelection'<br>
                       (Make sure 'QItemSelection' is registered using
          qRegisterMetaType().)<br>
          WARNING    QObject::startTimer: Timers cannot be started from
          another thread<br>
          <br>
          CRITICAL    Qt : QObject::killTimer: Timers cannot be stopped
          from another thread<br>
          CRITICAL    Qt : QObject::startTimer: Timers cannot be started
          from another thread<br>
          CRITICAL    Qt : QObject::killTimer: Timers cannot be stopped
          from another thread<br>
          CRITICAL    Qt : QObject::startTimer: Timers can only be used
          with threads started with QThread<br>
          <br>
          Only after saving and reopening QGIS do I get the correct
          result in the composer.<br>
          <br>
          What is missing to make it work properly?<br>
          <br>
          Can someone help me?</font></font><br>
    </p>
  </div>

_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div></div>