Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
libX11
libX11
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 95
    • Issues 95
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 3
    • Merge Requests 3
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • xorg
  • lib
  • libX11libX11
  • Issues
  • #129

Closed
Open
Opened Feb 02, 2021 by Logan Donaldson@21tesla

XAllocID usage in libxview requires a new solution / problem in xcb_io.c

I am currently trying to compile SunOS libxview for MacOS x86_64/arm64. My repository is

https://github.com/21tesla/libxview-macos

From what I have read, there is a problem with the way XAllocID is called thereby producing the following error:

Assertion failed: (ret != inval_id), function _XAllocID, file xcb_io.c, line 520.

There was a solution suggested; however, it does not appear to work anymore. I believe the problem is tied a bad implementation of XAlloc in server.c where XAlloc is called too many times. The best comment on it I could find was from 11 years ago!

Looking at libX11 source code, it's obvious why this happens. Since XView is inherently not thread-safe, there is no multi-threading involved and XInitThreads() is never called, so dpy->lock is NULL and so _XIDHandler() is never called by XLockDisplay(), thus the xcb->next_xid field stays 'invalid_id'. I think this is a bug, and could be also one cause of https://bugs.freedesktop.org/show_bug.cgi?id=27552 and https://xcb.pdx.freedesktop.narkive.com/vsAJcfE3/calling-xallocid-twice-causes-assertion-ret-inval-id-failed >

Here is the chunk of problematic code and the two options to call XAllocID that I have tested.

#ifndef __APPLE__

    (void) fprintf( stderr, "using xidLIst \n" );

    XAllocIDs((Display *)server->xdisplay, xidList, 4 );  
    
    /* XAllocIDs ((Display *)server->xdisplay, server->atom_mgr, 4); */
    
    server->atom_mgr[ATOM] = xidList[0];
    server->atom_mgr[NAME] = xidList[1]; 
    server->atom_mgr[TYPE] = xidList[2];
    server->atom_mgr[DATA] = xidList[3]; 

#else
    (void) fprintf( stderr, "using XAllocID \n" );
    server->atom_mgr[ATOM] = (XID) XAllocID((Display *)server->xdisplay);
    server->atom_mgr[NAME] = (XID) XAllocID((Display *)server->xdisplay);
    server->atom_mgr[TYPE] = (XID) XAllocID((Display *)server->xdisplay);
    server->atom_mgr[DATA] = (XID) XAllocID((Display *)server->xdisplay);

#endif

thank you for any insight

logan donaldson

Edited Feb 02, 2021 by Logan Donaldson
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: xorg/lib/libx11#129