[PATCH] shell: fix set_transient

Kristian Høgsberg krh at bitplanet.net
Thu Dec 8 10:05:42 PST 2011


On Thu, Dec 8, 2011 at 10:08 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Thu, 08 Dec 2011 17:04:47 +0200
> Tiago Vignatti <tiago.vignatti at linux.intel.com> wrote:
>
>> On 12/08/2011 04:42 PM, Pekka Paalanen wrote:
>> > In the wl_shell_surface migration, I forgot to correct one cast in
>> > shell_surface_set_transient(). 'parent_resource' is not a (struct
>> > wlsc_surface *) but (struct shell_surface *).
>> >
>> > This bug corrupts a wlsc_surface::output field, which later (in my
>> > experiments) leads to a segmentation fault in surface_frame().
>> >
>> > Fix the casts.
>> >
>> > Signed-off-by: Pekka Paalanen<ppaalanen at gmail.com>
>>
>> Reviewed-by: Tiago Vignatti <tiago.vignatti at intel.com>
>>
>> but I thought you'd implement the explicit cast scheme.. meh.
>
> Sorry, not today :-D
>
> I'll keep it in mind, though, for when I have time for it.
>
> For reference to others: it is for improving type safety in the
> compositor side, by putting some real pointer types into struct
> wl_*_interface's function arguments.

The question there is, what types?  We could make a struct
wl_compositor_resource that wraps the generic wl_resource, and then
move the void *data out of wl_resource and into wl_compsitor_resource
as a typesafe pointer.  To what though?  We could make it struct
wl_compositor * and just require that the compositor use those types.
I dunno, it just seems messy and I'm not sure it's worth it.

Kristian


More information about the wayland-devel mailing list