You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While testing to see if one could use multiple InitFunction/RestartFunction built-in function blocks in mlvwm config files for the purpose of appending commands/lines later (especially when Read-ing additional configuration files; see the Set default desktop pattern in themes in such a way that they can be overridden in the mlvwmrc project), I found a memory leak:
If SetStartFunction(), which is executed for the InitFunction/RestartFunction built-in functions, is called several times, the previously allocated memory for the linked list of ShortCuts will not be freed and the head of the linked list will be replaced. So, this is leaking memory.
I see several options for resolving this and addressing the want to append InitFunction/RestartFunction configuration block contents:
Fix SetStartFunction to free the previously allocated linked list if Scr.StartFunc is not null, then declare/document that InitFunction/RestartFunction built-in function blocks cannot append, only create/replace
Add new built-in function(s) for destroying/freeing the previously allocated linked list if Scr.StartFunc is not null (maybe DestroyInitFunction/DestroyRestartFunction?), then declare/document that InitFunction/RestartFunction create or append
Add new built-in functions for appending to (maybe AppendToInitFunction/AppendToRestartFunction?) and destroying/freeing (again, maybe DestroyInitFunctionDestroy/DestroyRestartFunction?) the previously allocated Scr.StartFunc linked list, then declare/document that: InitFunction/RestartFunction only create, AppendToInitFunction/AppendToRestartFunction create or append, and DestroyInitFunction/DestroyRestartFunction delete
I did look at the fvwm 2 manual page when preparing the proposed solutions. I'm leaning toward the second (InitFunction/RestartFunction create or append and add explicit DestroyInitFunction/DestroyRestartFunction built-in functions) or third (separate & explicit create/append/destroy built-in functions) options as that would allow more customization, especially in the mlvwmrc project's implementation.
The text was updated successfully, but these errors were encountered:
While testing to see if one could use multiple
InitFunction
/RestartFunction
built-in function blocks inmlvwm
config files for the purpose of appending commands/lines later (especially whenRead
-ing additional configuration files; see the Set default desktop pattern in themes in such a way that they can be overridden in the mlvwmrc project), I found a memory leak:SetStartFunction()
inmlvwm/config.c
initializes thenew
variable as a reference toScr.StartFunc
(new = &Scr.StartFunc;
), then the first iteration of thewhile
loop allocates memory for a newShortCut
intonew
/Scr.StartFunc
(*new = calloc( 1, sizeof( ShortCut ) );
). Subsequent iterations save a reference tonew
in theprev
variable and associate them as a linked list.If
SetStartFunction()
, which is executed for theInitFunction
/RestartFunction
built-in functions, is called several times, the previously allocated memory for the linked list ofShortCut
s will not be freed and the head of the linked list will be replaced. So, this is leaking memory.I see several options for resolving this and addressing the want to append
InitFunction
/RestartFunction
configuration block contents:SetStartFunction
to free the previously allocated linked list ifScr.StartFunc
is notnull
, then declare/document thatInitFunction
/RestartFunction
built-in function blocks cannot append, only create/replaceScr.StartFunc
is notnull
(maybeDestroyInitFunction
/DestroyRestartFunction
?), then declare/document thatInitFunction
/RestartFunction
create or appendAppendToInitFunction
/AppendToRestartFunction
?) and destroying/freeing (again, maybeDestroyInitFunctionDestroy
/DestroyRestartFunction
?) the previously allocatedScr.StartFunc
linked list, then declare/document that:InitFunction
/RestartFunction
only create,AppendToInitFunction
/AppendToRestartFunction
create or append, andDestroyInitFunction
/DestroyRestartFunction
deleteI did look at the fvwm 2 manual page when preparing the proposed solutions. I'm leaning toward the second (
InitFunction
/RestartFunction
create or append and add explicitDestroyInitFunction
/DestroyRestartFunction
built-in functions) or third (separate & explicit create/append/destroy built-in functions) options as that would allow more customization, especially in themlvwmrc
project's implementation.The text was updated successfully, but these errors were encountered: