gdk_image_get() error handling



Hi,

  It seems to me that gdk_image_get can't cope with errors correctly.
In the current CVS version, _gdk_x11_get_image() dereferences the
result of XGetImage() without checking that the XGetImage() actually
succeeded.

  This might not be so bad, but it also seems to me that the GetImage
protocol request is broken.  The server can return a BadMatch if you
try to GetImage from a region of a window that is off-screen -- but
unfortunately, there's no way to guarantee that the part of the window
you want will stay on screen while you perform the GetImage, without
locking the server.  (Personally I think the protocol should be
re-written to just leave off-screen regions undefined, as it currently
does for regions obscured by non-inferior windows, but who am I to
say...)  XGetImage() could also return NULL if it runs out of memory,
so _gdk_x11_get_image() really ought to check the return value.

  I'll file a report on bugzilla.gnome.org if that's appropriate, but
I wanted to check if I'm overlooking something first.  (Or to pick
somebody's brain if they have a better idea about how I can perform a
robust gdk_image_get()...)

Cheers,
Gary.
-- 
  Gary Wong    Consultant, Dependable Distributed Computing, AT&T Shannon Labs
        gtw research att com            http://www.cs.arizona.edu/~gary/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]