As pointed by Coverity, there is one case where the string returned by
WMGetTextFieldText could be left allocated.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is one case where the application dictionary
which is created temporarily (when saving the changes in the Window
Inspector) could be left allocated. It is now freed in the common path to
avoid problems.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity, it was possible to return early from the function
'listCallback' without de-allocating a temporary string. The string is now
requested after this early return.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointer by Coverity, the function wstrappend may move the string in
memory (because that's what realloc does if it can't expand the allocated
buffer in-place), so it is important to use the returned address and not
assume the old pointer is still valid.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the caller of the function 'getSavedState' assumes
that if the function returns 0 then the wstate is not initialised. This was
not actually true, so this patch changes 'getSavedState' to behave as
expected.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the memory allocated to contain the argument list
for spawning ourself was never released.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, if the function wShowCrashingDialogPanel is not
able to connect to the default screen, then the memory allocated for the
panel would be leaked.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there are some cases where the name of the file
returned by wIconChooserDialog could be left unfreed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The function wIconChooserDialog already makes sure that it returns
NULL if its result would have been an empty string, so it is not
necessary to re-check this in setIconCallback, this leads to
more complicated code and can't be optimised by the compiler.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, if the function wScreenInit fails to properly
attach to the screen then the storage structure and content were not
released before returning.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, if the target width or height for the center ended
being <= 0 then the image created to contain the generated assemblage would
be leaked.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, if there's no window to unmap in a workspace, then
the array used to build the list of the windows to be unmapped for
workspace change would not be freed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, if an invalid OPEN_MENU is used then the memory
allocated when parsing the line containing it would be leaked.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, if the word "WITH" was used in the content of the
root menu definition then its string would not be freed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the function 'ProgGetWMClass' always allocates the
strings returned in wm_class and wm_instance, so they always must be freed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, a string could be left unfreed in the case where
the window's attribute dialog is closed before an icon would be actually
chosen from the Icon Chooser Dialog.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, a string could be left unfreed in the case where
the docked application's settings dialog is closed before an icon would be
actually chosen from the Icon Chooser Dialog.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, in this specific case the string previously stored
in 'file' was lost when replaced with the string from 'db_icon'. The logic
have been simplified to avoid the case.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there was a memory leak when updating the shortcuts
in the menu for windows which occured when a shortcut was associated with
the window and this shortcut did not change.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is a check to make sure a pointer is not NULL
but it is still dereferenced later in the function. As the code is done so
that this pointer cannot be NULL then it is not necessary to check that.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This patch adds "FrameFocusedBorderColor" option for theming,
It should allow having borders better matching titlebar colors.
By default it's set to black.
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Long time ago I added this option so I could have wallpaper filling my
screen while preserving aspect ratio.
Seems like I didn't add it to WPrefs
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
As raised by Carlos R. Mafra and Doug Torrance, when an image is used in a
texture but the image cannot be loaded, there are some case where WPrefs
misbehaves.
This patch display a warning in every case where the image could not be
loaded, and always switch to black texture as a fallback, which was not the
case previously.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
According to NEWS, the DisplayFont option was removed in version 0.62.0 and
replaced by the WINGs system font. However, it was still referenced in a large
number of style files, as well as the utils getstyle, setstyle, convertfonts,
and the manpages for getstyle and setstyle. This patch removes all of these
references.
In addition, it updates the Czech, Slovak, and Russian translations of these
manpages to match the English versions. Note that I relied on Google translate, and it appears I may have re-encoded some characters when I saved the Czech
and Slovak files -- if you speak these languages, please take a look!
A few minor spelling errors were corrected in the English manpages.
The coding style in wmaker.git follows the conventions of the linux kernel.
Therefore, I'm stealing their 'checkpatch' tool in an attempt to maximize
"perfect" patches to wmaker-dev, at least coding-style wise :-)
Before submitting your patch, please ('please' here means you must) check
it with:
./checkpatch your-patch.diff
and use your common sense to address any violations (error and/or warnings) detected.
There will always be false positives and other complaints that sometimes are better
dealt with by leaving them alone. No tool is perfect, but it _will_ detect obvious
errors which you must fix (warnings can be sometimes ignored).
I modified the script by removing kernel-specific stuff, but I don't guarantee
that I removed everything. I also increased the line length warning to 115.
In any case, it seems to work here and hopefully it will lead to a cleaner
and more consistent code base for wmaker.
PS: You can also check existing files, e.g.,
./checkpatch.pl --file src/icon.c
The color well contains two views: view, consisting of the outer "button", and
colorView, consisting of the color itself. Previously, only clicking on view
would bring up the corresponding color panel, resulting in nonintuitive
behavior.
In response to Amadeusz's comments regarding my patch "WPrefs: Add ability to
edit FrameBorderColor/FrameSelectedBorderColor", this new patch attempts to
reduce the confusion between focused and selected windows. In particular,
only the frame border color for non-selected windows appears in the preview.
The frame border color for selected window colors can still be changed, but it
does not appear in the preview. In addition, the hand icon has been removed
from the preview for these two options.
I also looked into the possibility of adding a new border color for focused
windows. This appears to be nontrivial, as the border color belongs to
WFrameWindow, but the state of being focused belongs to WWindow.
When the condition can be simply checked in an if, it is better to do that
than to use a flow breaking goto.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity, the structure containing the callback functions
to handle the drag-and-drop actions could be freed but later re-used.
The correct behaviour is to keep the allocated memory for the structure.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the 'paintItem' function in the WMBrowser widget
is checking for nullity of its text argument, but before that it called the
strlen function which crashes on NULL pointer. This patch moves the strlen
call to the right place and reduce the lifespan of 'textLen' to highlight
incorrect tries to use the variable.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is a NULL pointer check at the end of the
function 'deleteFile' (which happens to not be necessary because wfree was
made to accept NULL pointers), however there are many things done before
that assumes the pointer is not NULL. The check is moved to where it
matters.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the variable 'dir' is passed by reference because
the function may update it; as it is never NULL (the function is local)
checking for that does not make sense. From the actual usage, it seems
logical that the check should have been on the value, not on the pointer.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the code was checking for NULL pointer to avoid
misbehaviour, but it actually dereferenced the pointer beforehand so the
crash would still happen.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the data returned by WMGetTextSelectedStream are
actually a newly allocated buffer, so we need to release it when we're done
with it.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the array used to build the result for the
function 'getStreamObjects' could leak in case of early return.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity, in the (rare) case where the wstrlcat would fail
the array for the result would not be freed before returning.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Coverity, the function 'WMGetTextFieldText' allocates memory
to generate the result string, so it has to be freed.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there is a small check for NULL pointer when
handling triple-click selection in a WMText, however this check is only
partially implemented so the code would crash later anyway.
This patch implement an appropriate skip to avoid crash, and includes a
log message to help debug if the case happens.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, despite apparent checks the function would fail if
trying to set a NULL title. Instead of trying to do over-complicated things
we just ignore (with a warning if NDEBUG is not set) the case. If user
wants an empty title, the correct way is to provide "" as we're not able to
remove a title.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by coverity, the case 'index < 0' cannot be true because it was
already earlier and handled with an early return.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>