shell: Cancel popups when triggering screensaver

This is part of the fix for bug 72540.  We cancel the popup grab when the
screensaver kicks in so that the screen unlock dialog can get input events.
The bigger problem is in mesa however, where we try to allocate new buffers
as cairo-gles2 does a gratuituous (but valid) eglMakeCurrent() as we
remove the tooltip or popup-menu.

Since we removed the weston_layer with the regular surfaces, EGL blocks
waiting for a frame event that never comes.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=72540
Revert part of 17bccaed428ac1f6ec9f8e667175ad81e90508ff

Commit 17bccaed428ac1f6ec9f8e667175ad81e90508ff accidentally reverted
the fix for 73490 from 5cbc7634043707c3a0e442014910fc7f6db317e0.
shell: Don't start a fade animation if we don't have an output

When the last window of the X11 compositor is closed during a fade or
while locked, we'll try to start a fade back to the lock screen.  However,
if we closed the last window, there are no outputs left and the animation
will try to run with surface->output == NULL.

https://bugs.freedesktop.org/show_bug.cgi?id=73665
backlight: fix backlight_path memory leak

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
log: print dummy timestamp if localtime call fails

Handle the case where localtime fails (NULL) and print
something else to indicate localtime is erroneous.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
wcap-decode: remove dead code

Avoids leaking memory we never use.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
screenshooter: check for NULL malloc and fix memleaks

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
clients/desktop-shell: check OOM conditions

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
use xzalloc wrapper instead

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
terminal: use xstrdup instead to handle OOM

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
weston-info: free allocated memory and check OOM conditions

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
clients/window: fail if NULL returned from frame_create

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
exposay: remove redundant NULL check in highlight_surface

exposay_highlight_surface() is called from exposay_pick(),
exposay_layout(), and exposay_maybe_move() where the esurface
parameter is already validated prior to the call.  This makes
the 'esurface' NULL check redundant.  This assumes any future
calls to exposay_highlight_surface() will also validate the
'esurface' parameter prior to the call.

This fixes the logic in exposay_highlight_surface so static
analyzers don't complain about the possibility that 'view'
might be NULL deref'd when a 'esurface' == NULL condition is
true.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
input-panel: validate return value of get_default_view

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
shell: validate get_animation_type parameter

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
shell: validate create_focus_surface results

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
shell: assert get_shell_surface() != NULL as appropriate

Various functions that operate on a weston_surface assume the
surface has a shell_surface.  That is, they unconditionally
deref the get_shell_surface() result.  Hence, if for some reason
the call to get_shell_surface() returned NULL to those functions then
a segmentation fault would occur and the program would crash.  So,
adding an assert(...) on the get_shell_surface() return value adds an
extra sanity check and does not change this behavior.  The assert also
adds an extra benefit to the programmer by documenting that the function
expects and requires the weston_surface to have a shell_surface and
would be a program logic error, otherwise.

The assert() also silences some static analyzers about the possible
NULL deref.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
shared/frame: fix potential memory leak in frame_create

In frame_create, we need to destroy any frame buttons created
in preceding calls to frame_button_create during the function
execution if any of the successive calls to frame_button_create
fail.

This has minimal severity since most, if not all, cases in
frame_button_create that result in a fail (i.e. NULL result) means
a program is OOM and the program will have to exit/abort anyway.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
compositor-wayland: don't free unallocated memory

Assigning a string constant (i.e. memory that we didn't allocate)
to a char* pointer and then freeing that pointer is bad news.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
compositor-wayland: free 'theme' config option value

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>