Hovering in symbols dialog over symbols with ampersand in description result in console warning

Bug #1288401 reported by Kris
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
jazzynico

Bug Description

With the symbols dialog open (docked in my case, but this should not matter) and the map symbols set selected, hovering over the "Accident & Emergency" symbol repeatedly prints the console warning (once for each GTK "hovering/moving" event):

(inkscape.exe:4576): Gtk-WARNING **: Failed to set text from markup due to error
 parsing markup: Error on line 1: Entity did not end with a semicolon; most like
ly you used an ampersand character without intending to start an entity ù escape
 ampersand as &

Tags: symbols
Revision history for this message
Kris (kris-degussem) wrote :

PS: tested on windows vista 64 bit r13114

Revision history for this message
su_v (suv-lp) wrote :

Confirmed with r13114 on OS X 10.7.5.

Changed in inkscape:
status: New → Won't Fix
status: Won't Fix → Confirmed
Revision history for this message
jazzynico (jazzynico) wrote :

Also reproduced on Crunchbang Waldorf, Inkscape trunk revision 13119.

Changed in inkscape:
status: Confirmed → Triaged
Revision history for this message
jazzynico (jazzynico) wrote :

According to the Gtk::IconView::set_tooltip_column() documentation (https://developer.gnome.org/gtkmm/stable/classGtk_1_1IconView.html#a0e81a913a4f9bde2bdf38d802eee2e37):

"Note that the signal handler sets the text with Gtk::Tooltip::set_markup(), so&, <, etc have to be escaped in the text."

Revision history for this message
jazzynico (jazzynico) wrote :

I've fixed the issue locally but the console warning also shows when hovering a symbol dropped on the canvas too.
Work in progress.

Changed in inkscape:
assignee: nobody → jazzynico (jazzynico)
status: Triaged → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Partial fix attached.

Changed in inkscape:
milestone: none → 0.91
Revision history for this message
jazzynico (jazzynico) wrote :

Fixed in the trunk, revision 13122.

Changed in inkscape:
milestone: 0.91 → none
status: In Progress → Fix Released
Revision history for this message
jazzynico (jazzynico) wrote :

Forgot to mention that r13122 also adds symbols translation in the status bar.

Revision history for this message
Martin Owens (doctormo) wrote :

This isn't the right fix. if the texts need to be escaped, they should be escaped where they are consumed by gtk labels and not before. Otherwise prints to the command line or dbus interactions, log files will all contain the escaped version instead of the actual text.

selection-describer.cpp:167 is the best place to put the escaping as we'll catch many more unescaping issues from any object.

I have a todo item to move the description/name code to using std::string (but that's another issue)

Revision history for this message
jazzynico (jazzynico) wrote :

> This isn't the right fix. if the texts need to be escaped, they should be escaped where they are consumed by gtk labels and not before.

I hesitated too, but escaping in selection-describer.cpp:167 would escape valid tags that (if I understand correctly) should not be escaped when passed to the message context. eg, line 178:

                _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
                              item_desc, in_phrase,
                              _("Use <b>Shift+D</b> to look up original"), _when_selected);

with item_desc escaped as "&lt;b&gt;Symbol&lt;/b&gt; called Accident &amp; Emergency".

I've tested it on Crunchbang Waldorf, and it even crashes the application...

Note that I know close to nothing on the message context. There must be some magic that could solve the issue elegantly.

Revision history for this message
Martin Owens (doctormo) wrote :

It looks more broken the more one looks at it. Obviously an sp-item's description and name shouldn't be markup. But the itemDescription call should have a better name so it can make it more obvious what it's doing. /It/ returns markup, but description() and Name do not (or should not).

I'll just have to refactor the markup stuff when I refactor the other bits.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.