[PATCH] Fix write to uninitialized bytes for XCB event
Scott Kostyshak
skostysh at lyx.org
Wed Feb 19 18:19:54 UTC 2020
On Wed, Feb 19, 2020 at 06:28:51PM +0100, Enrico Forestieri wrote:
> On Wed, Feb 19, 2020 at 06:13:08PM +0100, Pavel Sanda wrote:
> > On Wed, Feb 19, 2020 at 05:24:46PM +0100, Enrico Forestieri wrote:
> > > > Did not try, but I am afraid generally it won't, because
> > > > xcb_selection_notify_event_t is not enforced to have 32 bits,
> > > > while that's requested by underlying X routines. That's why
> > > > the padding by 0s.
> > >
> > > Ok, then probably a simple
> > > alignas(32) xcb_selection_notify_event_t nev;
> > > would have worked.
> >
> > Nice.
> >
> > > We are requiring C++11 these days, right?
> >
> > Can't remember, notions of gcc 4.7 in INSTALL is not strongly indicative of that ;)
>
> Uh? In the Requirements section I read:
>
> First of all, you will need a C++11 standard conforming compiler, like gcc
> (at least 4.7) or clang.
>
> > Need to check whether one of my antique system still compiles with 4.7 or 4.8,
> > maybe we can bump to 4.8.
> >
> > In any case I still tend to prefer using Qt macro (not because of technical
> > superiority but because if API changes then Qt folks will probably hit and
> > fix it sooner than we will).
>
> I could not find the macro you mention in the current Qt sources (5.14.1),
> but I found the following in src/plugins/platforms/xcb/xcbconnection.h
>
> template <typename T>
> struct alignas(32) q_padded_xcb_event : T { };
>
> which is then used as
> q_padded_xcb_event<xcb_selection_notify_event_t> event = {};
It seems I committed too soon. Sorry for not waiting. Both the macro
approach and Enrico's proposal are cleaner than my approach. I was
planning to pursue the macro approach in a follow-up commit. Regarding
C++11, don't we already use range-based for loops? Or is the question
about if we require *all* of C++11?
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200219/3c06869a/attachment.asc>
More information about the lyx-devel
mailing list