[Xcb] Segmentation fault while looping through protocol atoms list

Micah Nordland mpnordland at gmail.com
Wed Nov 28 04:09:03 PST 2012


I have this code to check if a window has a certain atom in it's
WM_PROTOCOLS property.

bool Window::haveProto(xcb_atom_t atom)
{
    unsigned int counter;
    std::cout << _protocols.atoms_len << std::endl;
    for(counter = 0; counter < _protocols.atoms_len; counter++)
    {
        if (_protocols.atoms[counter] == atom)
        {

            return true;
        }
    }
    return false;
}

The problem is, I get a sigsegv on the third create notify. The reason is
that with the previous two createnotifys is that the list of atoms was only
3 or 4 items long, but with the third, it's this huge number, 4294959856.
Why such a large number of atoms?
Here is my code for getting the list:

xcb_icccm_get_wm_protocols_reply_t Window::getWMProtocols()
{
    xcb_icccm_get_wm_protocols_reply_t reply;
    xcb_get_property_cookie_t cookie =
xcb_icccm_get_wm_protocols_unchecked(globalconf.conn,

_id,

globalconf.atomMap["WM_PROTOCOLS"]);
    xcb_icccm_get_wm_protocols_reply(globalconf.conn, cookie, &reply, NULL);
    return reply;
}

I'm trying to pattern this off awesomewm's code for doing this.

-- 
Praising my Savior all the day long,
Micah Nordland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20121128/8f62af27/attachment.html>


More information about the Xcb mailing list