<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Updating a Graphic in GraphicsLayer / thread safeness in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5149#M27</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, it looks like my assumption about ownership is wrong. I moved the code into a small testcase and calling updateGraphic() in a loop (via timer every 10ms) it's crashing now and then but everytime with a similar backtrace. If you're interested in this backtrace or the testcase, please let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Feb 2016 12:40:56 GMT</pubDate>
    <dc:creator>ChristianEhrlicher</dc:creator>
    <dc:date>2016-02-16T12:40:56Z</dc:date>
    <item>
      <title>Updating a Graphic in GraphicsLayer / thread safeness</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5148#M26</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we add a EsriRuntimeQt::Graphic to a EsriRuntimeQt::GraphicsLayer with GraphicsLayer::addGraphic(m_graphicPtr). Now we want to change the graphic (e.g. the line color). What's the recommended way to do this? The documentation does not say anything about this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;simply modify m_graphicPtr (and hope the GraphicsLayer notices the change and updates it's graphical representation)&lt;UL&gt;&lt;LI&gt;this would mean that all Functions for EsriRuntimeQt::Graphic must be thread-safe&lt;/LI&gt;&lt;LI&gt;or is there another synchronization mechanism&lt;/LI&gt;&lt;LI&gt;using updateGraphic with the same pointer used by addGraphic will lead to a crash (afaics addGraphic() moves ownership and updateGraphic() will delete the old graphic - at least this is what I'm seeing, the documentation only express this indirect with)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;create a new Graphic and replace the current one with EsriRuntimeQt::GraphicsLayer::updateGraphic()&lt;/LI&gt;&lt;LI&gt;other ways I'm not aware of&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2016 08:20:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5148#M26</guid>
      <dc:creator>ChristianEhrlicher</dc:creator>
      <dc:date>2016-02-15T08:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a Graphic in GraphicsLayer / thread safeness</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5149#M27</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, it looks like my assumption about ownership is wrong. I moved the code into a small testcase and calling updateGraphic() in a loop (via timer every 10ms) it's crashing now and then but everytime with a similar backtrace. If you're interested in this backtrace or the testcase, please let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 12:40:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5149#M27</guid>
      <dc:creator>ChristianEhrlicher</dc:creator>
      <dc:date>2016-02-16T12:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a Graphic in GraphicsLayer / thread safeness</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5150#M28</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Christian-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are wanting to update the symbol of a particular graphic, can you just use updateGraphic that takes in the graphic's ID and the new symbol? &lt;A href="https://developers.arcgis.com/qt/cpp/api-reference/class_esri_runtime_qt_1_1_graphics_layer.html#ad04956ed8ac390a2bd5bfceac305d0b5" rel="noreferrer" style="color: #2a80b9; font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px;" target="_blank" title="https://developers.arcgis.com/qt/cpp/api-reference/class_esri_runtime_qt_1_1_graphics_layer.html#ad04956ed8ac390a2bd5bfceac305d0b5"&gt;ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::GraphicsLayer Class Reference&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, you can create a new Graphic, and update the existing one with updateGraphic &lt;A href="https://developers.arcgis.com/qt/cpp/api-reference/class_esri_runtime_qt_1_1_graphics_layer.html#a327f617aa55ca69f67af8258369b8798" title="https://developers.arcgis.com/qt/cpp/api-reference/class_esri_runtime_qt_1_1_graphics_layer.html#a327f617aa55ca69f67af8258369b8798"&gt;ArcGIS Runtime SDK for Qt C++ API: EsriRuntimeQt::GraphicsLayer Class Reference&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That would be the recommended approach. I would need to see your code to get a hint at why it might be crashing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Luke &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 18:59:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5150#M28</guid>
      <dc:creator>LucasDanzinger</dc:creator>
      <dc:date>2016-02-16T18:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a Graphic in GraphicsLayer / thread safeness</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5151#M29</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What we're doing is more or less something like&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;qid = GraphicsLayer::addGraphic(m_graphicPtr);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;modify m_graphicPtr (change geometry or smth. else)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;GraphicsLayer::updateGraphic(gid, m_graphicPtr);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;do more modifications&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;GraphicsLayer::updateGraphic(gid, m_graphicPtr);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;This does lead to race conditions because the render thread is accessing attributes of m_grpahicPtr&amp;nbsp; while we're modifying those attributes.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;Our solution is exactly what you're proposed - using addGraphic(), working on a new (cloned) graphic for hte changes and then call updateGraphic() with new graphic.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;Thx,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-excerpt-slug"&gt;&lt;SPAN class="j-excerpt-slug"&gt;Christian&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 06:56:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/updating-a-graphic-in-graphicslayer-thread/m-p/5151#M29</guid>
      <dc:creator>ChristianEhrlicher</dc:creator>
      <dc:date>2016-02-17T06:56:16Z</dc:date>
    </item>
  </channel>
</rss>

