Skip to content

Commit

Permalink
#2153: more validation of window backing dimensions, catch exceptions…
Browse files Browse the repository at this point in the history
… and log a more helpful message

git-svn-id: https://xpra.org/svn/Xpra/trunk@21868 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 25, 2019
1 parent 02b913f commit 943e2d2
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/xpra/client/gtk2/pixmap_backing.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,29 @@ def do_init_new_backing_instance(self):
if w==0 or h==0:
#this can happen during cleanup
return
if self._alpha_enabled:
self._backing = gdk.Pixmap(None, w, h, 32)
screen = self._backing.get_screen()
rgba = screen.get_rgba_colormap()
if rgba is not None:
self._backing.set_colormap(rgba)
if w<0 or h<0:
log.warn("Warning: invalid backing dimensions %ix%i", w, h)
w = max(1, w)
h = max(1, h)
try:
if self._alpha_enabled:
self._backing = gdk.Pixmap(None, w, h, 32)
screen = self._backing.get_screen()
rgba = screen.get_rgba_colormap()
if rgba is not None:
self._backing.set_colormap(rgba)
else:
#cannot use transparency
log.warn("Warning: cannot display transparency, no RGBA colormap")
self._alpha_enabled = False
self._backing = gdk.Pixmap(gdk.get_default_root_window(), w, h)
else:
#cannot use transparency
log.warn("Warning: cannot display transparency, no RGBA colormap")
self._alpha_enabled = False
self._backing = gdk.Pixmap(gdk.get_default_root_window(), w, h)
else:
self._backing = gdk.Pixmap(gdk.get_default_root_window(), w, h)
except Exception as e:
log("do_init_new_backing_instance()", exc_info=True)
log.error("Error creating pixmap backing of size %ix%i", w, h)
log.error(" %s", e)
self._backing = None

def copy_backing(self, old_backing):
w, h = self.size
Expand Down

0 comments on commit 943e2d2

Please sign in to comment.