<p></p>
<p dir="auto">Example of finding group and pref by name:</p>
<div class="highlight highlight-source-c"><pre>StashGroup *group = stash_group_get_group_by_name(<span class="pl-s"><span class="pl-pds">"</span>cup<span class="pl-pds">"</span></span>);
<span class="pl-k">if</span> (group) {
  StashPref *pref = <span class="pl-c1">stash_group_get_pref_by_name</span>(group, <span class="pl-s"><span class="pl-pds">"</span>price<span class="pl-pds">"</span></span>);
  <span class="pl-k">if</span> (pref) {
    <span class="pl-c1">msgwin_status_add</span>(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-c1">%s</span>.<span class="pl-c1">%s</span> = <span class="pl-c1">%f</span><span class="pl-pds">"</span></span>, group-><span class="pl-smi">name</span>, pref-><span class="pl-smi">key_name</span>, *(gdouble *)pref-><span class="pl-smi">setting</span>);
  } <span class="pl-k">else</span> {
    <span class="pl-c1">msgwin_status_add</span>(<span class="pl-s"><span class="pl-pds">"</span>pref not found<span class="pl-pds">"</span></span>);
  }
} <span class="pl-k">else</span> {
  <span class="pl-c1">msgwin_status_add</span>(<span class="pl-s"><span class="pl-pds">"</span>group not found<span class="pl-pds">"</span></span>);
}</pre></div>
<p dir="auto">Problem: Doesn't work if used after <code>stash_group_free()</code>.</p>
<p dir="auto">In addition to reviewing memory management... Some potential solutions:</p>
<ul dir="auto">
<li>Rewrite "free" to defer actual deallocation until Geany is being shutdown.  Pro: Minimize changes to existing code, maybe.  Con: "free" doesn't do what it says it will.</li>
<li>Rewrite code to defer deallocation until Geany is being shutdown.  Pro: "free" does what it says it will.  Con: Probably will require extensive changes to existing code.</li>
<li>Replace "free" with "free_later" (or some such).  Pro: "free" and "free_later" do what they say they will.  Just need to replace "free" with "free_later" in existing code.  Con: Use of "free" can still prevent the lookup from working.</li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/3000#issuecomment-968214385">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJYMZNHXVI4AH4QVISLUL5H27ANCNFSM5H7EP4HA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AAIOWJ6NAXYB7YWLNR5CFYTUL5H27A5CNFSM5H7EP4HKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHG24O4I.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/3000#issuecomment-968214385",
"url": "https://github.com/geany/geany/pull/3000#issuecomment-968214385",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>