Emmanuel Thomas-Maurin <manutm007 gmail com> wrote: > On 04/20/2011 02:34 AM, Morten Welinder wrote: > >> If you really want to safely pass a very long text, > >> you will have to know the font (family and size) then check with stuff > >> like pango_layout_set_text() and pango_layout_get_pixel_size(). The application where I noticed the problem doesn't intentionally pass a very long text. It passes a text that comes from an untrusted source (similar to Morten's example below) and the assumption made by the authors seems to be that GTK will deal with the rest, or the documentation would explicitly mention it. If it is considered acceptable for gtk_widget_set_tooltip_text() to crash the application, I'd consider that worth documenting, too. Preferably together with a complete list of circumstances where crashes are to be expected. > > This happened in Gnumeric at some point too. Basically, every time user > > supplied string make it into tooltips, this will happen. So it's > > probably better > > to fix this in gtk+. > I don't think pixmap dimensions limit is mentioned in the GTK/GDK doc. > Width and height type is gint, not guint16 or gint16. Is the pixmap dimension limit really that important here? If the tooltip is wider or higher than my screen I can only see parts of the tooltip anyway. If I press a key to switch desktops the tooltip disappears, so GTK could simply truncate the tooltip to the resolution of my screen and I wouldn't be able to tell the difference. If getting the actual resolution is too much work, it could be truncated to some arbitrary size. I think even not showing a tooltip at all, or replacing the text provided by the application with something like "tooltip doesn't fit screen" would be a behaviour that is vastly superior to crashing and less surprising for developers that are reading the GTK documentation but aren't familiar with the actual code. Fabian
Attachment:
signature.asc
Description: PGP signature