Use NewColorbar more consistently - #2655
Merged
Merged
Conversation
There is a function (NewColorbar) which deals with the bookkeeping around allocating memory for colorbars. Use NewColobar in readsmv.c where previously different approaches were taken to allocting colobar memory. This ensures a consistent approach.
Contributor
|
Thanks for catching this jake. Ill take a look when i get back tomorrow
Glenn
Glenn Forney
…On Mon, Aug 10, 2026, 3:28 PM JakeOShannessy ***@***.***> wrote:
I encountered a bug when you have exactly 10 user defined colorbars with 3
or more colorbars defined in the ini file.. The code which reads the .ini
files wasn't allocating extra space in the same way as other instances in
the code, and therefore could attempt to write to unallocated memory with a
certain number of colorbars.
Other code generally uses the NewColorbar function, which deals with all
the memory resize logic and initialization. The PR updates the two
locations remaining locations which didn't use that function (thereby
addressing the bug).
NewColorbar is now the only place in the code which increments ncolorbars.
This also adds a little more documentation where appropriate.
------------------------------
You can view, comment on, or merge this pull request online at:
#2655
Commit Summary
- 31f5938
<31f5938>
use NewColorbar more consistently
File Changes
(4 files <https://github.com/firemodels/smv/pull/2655/files>)
- *M* Source/shared/colorbars.c
<https://github.com/firemodels/smv/pull/2655/files#diff-956395002c14547d70f85b26218a86c9901e8a381a7c2d804adacf3f50e16886>
(16)
- *M* Source/shared/colorbars.h
<https://github.com/firemodels/smv/pull/2655/files#diff-227cf3d20faafff7274ee79a7ef0efa483bffd266e34639006c55f148a416d01>
(3)
- *M* Source/smokeview/colortimebar.c
<https://github.com/firemodels/smv/pull/2655/files#diff-0fcfd448be8adc0e72e0cce609b67dec393b877ef57d4f5e5b56a61a4f80050b>
(12)
- *M* Source/smokeview/readsmv.c
<https://github.com/firemodels/smv/pull/2655/files#diff-d1f9d1862de44bb535caa17293741c7d177d5e6aafcaa6bf95a89c01f04cfb85>
(19)
Patch Links:
- https://github.com/firemodels/smv/pull/2655.patch
- https://github.com/firemodels/smv/pull/2655.diff
—
Reply to this email directly, view it on GitHub
<#2655?email_source=notifications&email_token=AC6UCRTQEEJBI5FZKW2ROPL5JIO4HA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DENBXGY2TQMBWHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC6UCRTYSYHXIS4G6VYMCGD5JIO4HAVCNFSNUABEKJSXA33TNF2G64TZHM3DOMBVGE3DCOB3JFZXG5LFHM2TCMJTGYZDSMBUGOQXMAQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I encountered a bug when you have exactly 10 user defined colorbars with 3 or more colorbars defined in the ini file.. The code which reads the .ini files wasn't allocating extra space in the same way as other instances in the code, and therefore could attempt to write to unallocated memory with a certain number of colorbars.
Other code generally uses the
NewColorbarfunction, which deals with all the memory resize logic and initialization. The PR updates the two locations remaining locations which didn't use that function (thereby addressing the bug).NewColorbaris now the only place in the code which incrementsncolorbars.This also adds a little more documentation where appropriate.