After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 79191 - gdk_window_set_back_pixmap call can generate BadMatch X Window System error.
gdk_window_set_back_pixmap call can generate BadMatch X Window System error.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.0.x
Other Solaris
: Normal major
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2002-04-19 07:00 UTC by Shivram U
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.73 KB, patch)
2002-04-19 07:04 UTC, Shivram U
none Details | Review

Description Shivram U 2002-04-19 07:00:44 UTC
In gdk/x11/gdkwindow-x11.c (gdk_window_set_back_pixmap), if the pixmap's 
depth does not match with the window depth a BadMatch X Window System 
error results.
Comment 1 Shivram U 2002-04-19 07:04:13 UTC
Attaching a patch which fixes this.
The patch does the following.
1. If the pixmap depth matches the window depth then we go ahead and 
set the background pixmap for the window.
2. Else we do not set the background pixmap for the window.
Comment 2 Shivram U 2002-04-19 07:04:54 UTC
Created attachment 7799 [details] [review]
proposed patch
Comment 3 Shivram U 2002-04-19 07:06:08 UTC
This bug is also related to bug #78061
Comment 4 Owen Taylor 2002-04-19 12:25:22 UTC
If we applied sommething like this, it would only be as a debugging aid.
Calling this function with mismatched depths is not allowed.
Comment 5 Bharat Tewari 2002-04-30 07:50:51 UTC
i think that this was fixed as a part of the nautilus bug (78061). We 
ourselves are not aware of any applications which calls this function 
with different depths but if we can put up the check atleast it will 
not have crashes that we have seen with nautilus. 
Comment 6 Shivram U 2002-04-30 09:21:09 UTC
I still feel the check is needed. If we know something is going to 
fail, we have to put a check for that, although we know the function 
should not be called with those invalid parameters. The reasoning is 
the same as the check made for the window passed being NULL or not.

Bharat: The nautilus bug (78096) which was fixed, used to call 
XSetWindowBackgroundPixmap() explicitly and that why the problem. It 
never used to call gdk_window_set_back_pixmap().
The function that will cause a problem is nautilus/libnautilus-
private/nautilus-directory-background.c where we call 
gdk_window_set_back_pixmap().

I guess a separate bug can be filed under nautilus for this. However 
to prevent such errors the check has to be made in gdk too.
Comment 7 Owen Taylor 2002-05-14 19:46:19 UTC
I've comitted something along these lines. (To HEAD, not
stable, since isn't a bug fix.)

(Note that the sense of the comparison in your patch is
backwards:

 g_return_if_fail (a != b)

is essentially same as:

 g_assert (a != b)

It's an assertion that "a != b".)

But hopefully it's clear that this does not make any code
work that didn't previously work ... it's just a debugging
aid.

Tue May 14 15:40:49 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkwindow-{linux-fb,win32,x11.c}
(gdk_window_set_back_pixmap):        Add a sanity g_return_if_fail()
check for the depths
        for the window and pixmap. (#79191, Shivaram Upadhyayula)
Comment 8 Shivram U 2002-05-15 07:50:21 UTC
Oops. I got it wrong there :-). Thanks Owen..