ssj71 / infamousPlugins

LV2 Audio Plugins for Linux
http://ssj71.github.io/infamousPlugins
GNU General Public License v2.0
88 stars 12 forks source link

Useless widget pointer assignment #12

Closed falkTX closed 9 years ago

falkTX commented 9 years ago

I was checking your recent code and found this:

widget = (LV2UI_Widget*)fl_xid(self->ui);

'widget' is of type 'LV2UI_Widget*', but that's because you're supposed to de-reference the pointer.

If you look into the 'LV2UI_Widget' type you'll see it's just a typedef for 'void*', so the widget type itself is a pointer already.

Right now in your code you assign the pointer of the widget locally, which does nothing. Instead you should do:

if (widget) { // make sure to not de-reference a null pointer
    *widget = (LV2UI_Widget)fl_xid(self->ui);
}

See this for an example: https://github.com/DISTRHO/DPF/blob/master/distrho/src/DistrhoUILV2.cpp#L55

ssj71 commented 9 years ago

oops thats a stupid mistake. Thanks for pointing it out. I'll fix that today.

ssj71 commented 9 years ago

whoohoo! it now resizes in ardour! thanks again. :)