Bug 557453

Summary: openmotif 2.3.1 causes BadDrawable error when repainting labels
Product: Red Hat Enterprise Linux 5 Reporter: Olivier Fourdan <ofourdan>
Component: openmotifAssignee: Thomas Woerner <twoerner>
Status: CLOSED ERRATA QA Contact: Filip Holec <fholec>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.5CC: asersen, azelinka, fholec, jwest, kem, pknirsch, psplicha, tao
Target Milestone: rcKeywords: Patch, Regression, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 00:32:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 569907    
Attachments:
Description Flags
Proposed patch
none
Proposed patch for Label and LabelG none

Description Olivier Fourdan 2010-01-21 14:44:33 UTC
Created attachment 385929 [details]
Proposed patch

Description of problem:

Customer is using a binary application that works fine in openmotif 2.3.0, but fails with the following X error with openmotif 2.3.1:

    X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
    Major opcode of failed request:  14 (X_GetGeometry)
    Resource id in failed request:  0x2

Version-Release number of selected component (if applicable):

openmotif-2.3.1-2.el5

How reproducible:

Always

Steps to Reproduce:
1. Run attached test application
  
Actual results:

    X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
    Major opcode of failed request:  14 (X_GetGeometry)
    Resource id in failed request:  0x2

Expected results:

No X error.

Additional info:

Running the application in synchronized mode breaking on _XError() in gdb gives the following backtrace:

#0  _XError (dpy=<value optimized out>, rep=<value optimized out>) at XlibInt.c:2855
#1  0x005b4914 in _XReply (dpy=<value optimized out>, rep=<value optimized out>, extra=<value optimized out>, discard=<value optimized out>) at XlibInt.c:1817
#2  0x005944a0 in XGetGeometry (dpy=<value optimized out>, d=<value optimized out>, root=<value optimized out>, x=<value optimized out>, y=<value optimized out>, width=<value optimized out>,
   height=<value optimized out>, borderWidth=<value optimized out>, depth=<value optimized out>) at GetGeom.c:45
#3  0xf7e4aa97 in _XmxpmCreateImageFromPixmap (display=0x879fcc0, pixmap=2, ximage_return=0xffe7c4d8, width=0xffe7c4d0, height=0xffe7c4cc) at XpmCrIFrP.c:56
#4  0xf7e54cb1 in XmeXpmCreateXpmImageFromPixmap (display=0x879fcc0, pixmap=4293379120, shapemask=0, xpmimage=0xffe7c61c, attributes=0x0) at Xpmscan.c:928
#5  0xf7d4e05d in Redisplay (wid=0x87fd9f0, event=0x0, region=0x0) at Label.c:1412
#6  0xf7dc4aa7 in redisplayPixmap (tb=0x87fd9f0, event=0x0, region=0x0) at ToggleB.c:723
#7  0xf7dc7b51 in SetValues (current=0xffe7cb00, request=0xffe7c7e0, new_w=0x87fd9f0, args=0x8802538, num_args=0xffe7c788) at ToggleB.c:3180
[...]

The crash comes from a part of the code that is not present on openmotif 2.3.0 (which explains why that works with 2.3.0):

In lib/Xm/Label.c ConvertToBW(Widget w, Pixmap pm) line 1404 called from Redisplay() in lib/Xm/Label.c line 1578:

  1468 static void
  1469 Redisplay(
       [...]
  1574           Pixmap pix_use = Pix_insen (lw) ;
  1575 
  1576           if (pix_use == XmUNSPECIFIED_PIXMAP)
  1577 #ifdef FIX_1381
  1578                 Pix_insen(lw) = pix_use = ConvertToBW(wid, Pix(lw));
  1579 #else
  1580                 pix_use = Pix(lw);
  1581 #endif
       [...]

The offending code is from upstream bug 1381:

   http://bugs.motifzone.net/show_bug.cgi?id=1381 

But we know that pixmap=2 in frame #3 (and als ofrom the X Error itself, "Resource id in failed request:  0x2") meaning that Pix(lw) is 2.

Interestingly, XmUNSPECIFIED_PIXMAP == 2 so I think we have an unhandled case here where Pix(lw) is *also* XmUNSPECIFIED_PIXMAP (2 is not a valid XID and later causes the X error).

Thus using something like this fixes the problem:

  1468 static void
  1469 Redisplay(
       [...]
  1574           Pixmap pix_use = Pix_insen (lw) ;
  1575 
  1576           if (pix_use == XmUNSPECIFIED_PIXMAP)
  1577 #ifdef FIX_1381
  1578                 if (Pix(lw) != XmUNSPECIFIED_PIXMAP)
  1579                         Pix_insen(lw) = pix_use = ConvertToBW(wid, Pix(lw));
  1580 #else
  1581                 pix_use = Pix(lw);
  1582 #endif
       [...]

Proposed patch attached.

Comment 4 Thomas Woerner 2010-02-17 18:10:30 UTC
Created attachment 394784 [details]
Proposed patch for Label and LabelG

Comment 22 errata-xmlrpc 2013-10-01 00:32:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1355.html