~vanvugt/compiz/fix-974242-976032

« back to all changes in this revision

Viewing changes to gtk/window-decorator/wnck.c

  • Committer: Tarmac
  • Author(s): Daniel van Vugt
  • Date: 2012-07-11 11:29:47 UTC
  • mfrom: (3279.2.1 popey)
  • Revision ID: tarmac-20120711112947-ji4py6t52zzhsc2h
Add extra checks to avoid passing an invalid xid to XGetWindowProperty which
would result in fatal error: BadWindow (invalid Window parameter).
(LP: #1019337)
. Fixes: https://bugs.launchpad.net/bugs/1019337. Approved by Sam Spilsbury, jenkins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
const gchar *
29
29
get_frame_type (WnckWindow *win)
30
30
{
31
 
    WnckWindowType wnck_type = wnck_window_get_window_type (win);
 
31
    WnckWindowType wnck_type;
 
32
 
 
33
    if (win == NULL)
 
34
        return "bare";
 
35
 
 
36
    wnck_type  = wnck_window_get_window_type (win);
32
37
 
33
38
    switch (wnck_type)
34
39
    {
40
45
            int           result, format;
41
46
            unsigned long n, left;
42
47
            unsigned char *data;
43
 
 
44
 
            result = XGetWindowProperty (gdk_x11_get_default_xdisplay (), wnck_window_get_xid (win),
 
48
            Window        xid = wnck_window_get_xid (win);
 
49
 
 
50
            if (xid == None)
 
51
                return "bare";
 
52
 
 
53
            result = XGetWindowProperty (gdk_x11_get_default_xdisplay (), xid,
45
54
                                         net_wm_state_atom,
46
55
                                         0L, 1024L, FALSE, XA_ATOM, &actual, &format,
47
56
                                         &n, &left, &data);