scottkirkwood / key-mon

Automatically exported from code.google.com/p/key-mon
Apache License 2.0
141 stars 38 forks source link

I changed the theme to 'oblivion-slim' and the app crashed with an exception #101

Open Tche333 opened 2 years ago

Tche333 commented 2 years ago

Upon trying the different theme with latest version (Keymon version 1.20.), I ended up choosing oblivion-slim which crashed the app. Since settings are saved, upon next start the app keeps on crashing. The root cause seems to be a faulty temporary created svg file.

Activating the --debug upon start helped me to manually change the settings in order to be able to re-use the program.

--- root cause analysis --- The latest debug log line lazy_pixbuf_creator.py [111]: DEBUG Read file /home//.local/lib/python3.8/site-packages/keymon/themes/oblivion-slim/shift.svg --- Logging error --- Traceback (most recent call last): File "/home/tche/.local/lib/python3.8/site-packages/keymon/lazy_pixbuf_creator.py", line 130, in _read_from_bytes img = GdkPixbuf.Pixbuf.new_from_file(fname) gi.repository.GLib.GError: rsvg-error-quark: Failed to load image “/tmp/keymon-d_zvmwwb.svg”: XML parse error: Error domain 1 code 42 on line 276 column 50 of data: Attribute transform redefined (0)

I've verified the SVG in keymon/themes directory and all are ok. But I could not open the one created in /tmp with the default image viewer (xviewer 3.2.4): same error is reported.

Upon comparing the shift.svg with the /tmp/keymon-d_zvmwwb.svg in text editor, as stated in the error above "Attribute transform redefined", I could find on line 271 1) in the shift.svg <g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1" transform="translate(-2.2845036,-1.9887758)"> 2) in the tmp file created <g transform="scale(1.2, 1.2)" id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1" transform="translate(-2.2845036,-1.9887758)">

To validate this is indeed the root cause, I manually remove this first transform attribute from the SVG file in /tmp and now I could open the file using the default file viewer. No error reported anymore: 2 transform attributes invalidates the XML.

It should then have been (the scale operator is added after the translate in the already existing transform attribute. <g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1" transform="translate(-2.2845036,-1.9887758) scale(1.2, 1.2)">

Fabian42 commented 6 months ago

~/.config/key-mon/config is not listed under owned files by pacman, that is quite confusing. I cat-ed a ton of files and found nothing, then came here to report the same bug and only then found out about --debug, which told me that path.