Bug 3543 - previous html render is shown (momentarily) on opening next html part
Summary: previous html render is shown (momentarily) on opening next html part
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins/Fancy (show other bugs)
Version: 3.13.1
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2015-10-20 01:27 UTC by Pierre Fortin
Modified: 2017-09-26 09:24 UTC (History)
1 user (show)

See Also:


Attachments
log file (16.65 KB, text/plain)
2015-10-20 17:30 UTC, Pierre Fortin
no flags Details
reply from Samsung (51.80 KB, image/jpeg)
2015-10-21 11:48 UTC, Pierre Fortin
no flags Details

Description Pierre Fortin 2015-10-20 01:27:36 UTC
See list archive:
 http://lists.claws-mail.org/pipermail/users/2015-October/014546.html

Not sure what the trigger is yet; but I moved the message into a fresh CM instance and cm --debug reports this when I try to view the html via Fancy:
mimeview.c:842:text/html
fancy_viewer.c:865:fancy_viewer_create
Vector smash protection is enabled.
fancy_viewer.c:83:fancy_get_widget: 0x1b06930
fancy_viewer.c:83:fancy_get_widget: 0x1b06930
fancy_viewer.c:233:filename: /home/pf3/.claws-mail/mimetmp/00000001.mimetmp.html
fancy_viewer.c:249:using UTF-8 charset
fancy_viewer.c:252:zoom_level: 100
fancy_viewer.c:385:navigation requested to file:///home/pf3/.claws-mail/mimetmp/00000001.mimetmp.html
openjdk version "1.8.0_60"
OpenJDK Runtime Environment (build 1.8.0_60-b27)
OpenJDK 64-Bit Server VM (build 25.60-b23, mixed mode)
fancy_viewer.c:444:Starting request of 58 file:///home/pf3/.claws-mail/mimetmp/00000001.mimetmp.html

There seems to be a corner case where the current message number is not updated before calling mimeview.  In fact, I can view any message in any folder and:
1) if the last viewed message has html, last message's html is what I see; or, 
2) if the last viewed message has no html, I get a blank text area.

So far, things I've found wrong with the trigger message are:
- a mismatched double-quote -- removing it doesn't change anything obvious.
- missing href="..." on 4th anchor -- adding it doesn't help
- missing html code, such as:
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.=
  w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns=3D"http://www.w3.org/1999/xhtml">
  ...
  </html>

Adding the above html code allowed Fancy to display the html portion.

While this is a sender error; the CM bug is in not at least initializing the message pointer to avoid displaying some other message's content.
Comment 1 Pierre Fortin 2015-10-20 01:45:50 UTC
Reported bad email structure to Samsung...  hope they fix it; but not going to hold my breath...
Comment 2 Pierre Fortin 2015-10-20 16:01:54 UTC
Unloaded all plugins except Fancy.
Restarted with --debug.
Opened non-broken message & viewed its html, then switched to broken one and got:

fancy_viewer.c:385:navigation requested to about:blank
fancy_viewer.c:362:fancy_clear_viewer
    message/rfc822 (offset:0 length:15100 encoding: 6)
        text/html (offset:3154 length:11946 encoding: 3)
fancy_viewer.c:385:navigation requested to about:blank
fancy_viewer.c:362:fancy_clear_viewer
fancy_viewer.c:385:navigation requested to about:blank
fancy_viewer.c:362:fancy_clear_viewer
textview.c:713:TIMING textview_add_part : 0s000ms
textview.c:829:TIMING textview_add_part : 0s010ms
textview.c:846:TIMING recursive_add_parts : 0s010ms
textview.c:892:TIMING recursive_add_parts : 0s010ms
textview.c:652:TIMING textview_show_part : 0s011ms
summaryview.c:3658:TIMING summary_display_msg_full : 0s016ms

at this point, html not displayed. Clicked on icon and got:

mimeview.c:842:text/html
fancy_viewer.c:83:fancy_get_widget: 0x13df330

(cm:8315): GLib-CRITICAL **: Source ID 1077 was not found when attempting to remove it
fancy_viewer.c:233:filename: /home/pf3/.claws-mail/mimetmp/00000002.mimetmp.html
fancy_viewer.c:249:using UTF-8 charset
fancy_viewer.c:252:zoom_level: 100
fancy_viewer.c:385:navigation requested to file:///home/pf3/.claws-mail/mimetmp/00000002.mimetmp.html
fancy_viewer.c:444:Starting request of 58 file:///home/pf3/.claws-mail/mimetmp/00000002.mimetmp.html

with html from previously viewed msg showing...
Comment 3 Pierre Fortin 2015-10-20 16:47:37 UTC
This comment only concerns contents of ~/.claws-mail/mimetmp/

3.13git20 - new instance containing only:
- initial CM welcome msg - no html ("W" below)
- broken html msg ("B" below)
- good html msg ("G" below)

~/.claws-mail/mimetmp/ is empty at startup.

Switch to G:
-rw------- 1 pf3 pf3 2994 Oct 20 10:36 claws.ADPP6X  (G:txt)

Display G html: 
-rw-rw-r-- 1 pf3 pf3 51442 Oct 20 10:36 00000000.mimetmp.html  (G:html)
-rw------- 1 pf3 pf3  2994 Oct 20 10:36 claws.ADPP6X           (G:txt)
-rw------- 1 pf3 pf3 51442 Oct 20 10:36 claws.UFJN6X           (G:html)

Switch to B:
-rw-rw-r-- 1 pf3 pf3 51442 Oct 20 10:36 00000000.mimetmp.html  (G:html)
-rw------- 1 pf3 pf3 11240 Oct 20 10:37 claws.DRQ56X           (B:html)

Display B html:
-rw-rw-r-- 1 pf3 pf3 11240 Oct 20 10:38 00000002.mimetmp.html  (B:html)
-rw------- 1 pf3 pf3 11240 Oct 20 10:37 claws.DRQ56X           (B:html)

Switch back to G:
-rw-rw-r-- 1 pf3 pf3 11240 Oct 20 10:38 00000002.mimetmp.html  (B:html)
-rw------- 1 pf3 pf3  2994 Oct 20 10:39 claws.HPUO6X           (G:txt)

Display G html:
-rw-rw-r-- 1 pf3 pf3 51442 Oct 20 10:39 00000003.mimetmp.html  (G:html)
-rw------- 1 pf3 pf3 51442 Oct 20 10:39 claws.7AFQ6X           (G:html)
-rw------- 1 pf3 pf3  2994 Oct 20 10:39 claws.HPUO6X           (G:txt)

Switch to W:
-rw-rw-r-- 1 pf3 pf3 51442 Oct 20 10:39 00000003.mimetmp.html  (G:html)
Comment 4 Pierre Fortin 2015-10-20 17:30:47 UTC
Created attachment 1581 [details]
log file

Start CM[1], opens with nothing displayed.
Switch to inbox, msgs display; but none open
Click on W
Click on G
Display G html
Click on B
Display B html
Click close button

[1] Pretty much virgin...  only Fancy loaded.
Comment 5 Pierre Fortin 2015-10-21 05:33:52 UTC
I didn't continue learning C over the years, so this is puzzling to me:

mimeview.c:819:
static MimeViewer *get_viewer_for_content_type(MimeView *mimeview, const gchar *content_type)
mimeview.c:875:
static MimeViewer *get_viewer_for_mimeinfo(MimeView *mimeview, MimeInfo *partinfo)

Isn't this 2 declarations with the same name?
Comment 6 Ricardo Mones 2015-10-21 10:00:29 UTC
(In reply to comment #5)
> I didn't continue learning C over the years, so this is puzzling to me:
> 
> mimeview.c:819:
> static MimeViewer *get_viewer_for_content_type(MimeView *mimeview, const
> gchar *content_type)
> mimeview.c:875:
> static MimeViewer *get_viewer_for_mimeinfo(MimeView *mimeview, MimeInfo
> *partinfo)
> 
> Isn't this 2 declarations with the same name?

No, it isn't :) one is named "get_viewer_for_content_type" and the other "get_viewer_for_mimeinfo".
Comment 7 Pierre Fortin 2015-10-21 11:25:17 UTC
Last time I wrote any C was when the language manual was the original K&R
book...  it has changed immensely since then...  though if I'd read
the rest of these statements, the parens would have been a clue...  :)

That and lack of sleep... 
Cheers!

BTW, list members often complain about message copies sent to the list and directly...  so why does CM's bugzilla send two copies?
Comment 8 Pierre Fortin 2015-10-21 11:48:52 UTC
Created attachment 1582 [details]
reply from Samsung

Sorry for the screenshot; but:

1. it's the replay from Samsung from which I can't copy/paste because the reply is treated mostly as a single link (all green).

2. now that I have 2 broken replies, I can open a good message and then switch back and forth between the 2 bad ones and Fancy always displays the content of that last good message viewed
Comment 9 Pierre Fortin 2015-10-22 14:26:51 UTC
When switching between msgs, are all vars cleared|re-initialized? gdb has not provided a better clue yet & C is quite verbose for my aging brain. :)

Testing shows that the minimum "correction" needed to a broken msg is the addition of "<html>\n" to avoid the bug. The broken msgs are "Content-Type: text/html;" (in header) -- non-multi-part. The html fancy displays is always from the last html stuff displayed, no matter which folder it was from, nor how long ago; {multi,single}-part in previous view doesn't affect the issue. 

Smells like some var(s) still contain(s) un[re]initialized data. Restarting CM & going directly to a broken msg, fancy shows a blank pane -- or its html if merely "<html>\n" is added.

I wondered about treating the text as html if "<" is the first character; but finding the {pointer,data,file} containing the old info is the only future-proof solution.
Comment 10 Robert 2017-09-25 22:14:51 UTC
I just recently updated from Fedora 25 (which did not have this problem) to Fedora 26 (which does).

* claws-mail-3.14.1-1.fc25.x86_64 - is not effected
* claws-mail-3.14.1-4.fc26.x86_64 - is effected

...this leads me to believe that the bug (or at least, the origin of this issue) rests in a package other than claws-mail or claws-mail-plugins.

Observations:
* Sometimes the html is never rendered (simply shows white/blank).
* When checked, I find that the html in the mimetmp directory is correct (for this email), just not displayed/updated in the panel.
* It *feels* like a missed timer or callback.

I found this reference too:
* https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1436975.html
** Version: 3.13.2

I recommend:
* bumping the effected version to 3.14.1
* adding more debug log statements after 'fancy_viewer.c:436:Starting request of...' (or at the very start of all the receiving callbacks)
Comment 11 Paul 2017-09-25 23:00:13 UTC
this is fixed in GIT
Comment 12 Paul 2017-09-25 23:05:12 UTC
(In reply to comment #10)
> I recommend:
> * bumping the effected version to 3.14.1

This would not help. The affected (reported) version indicates that the bug first occurred in that version, if it is not fixed then it will clearly occur in subsequent versions too. Bumping the version would just (wrongly) imply where the bug first occurred.
Comment 13 Colin Leroy 2017-09-26 09:24:09 UTC
Hasn't the fix been released in 3.15 or 3.15.1 ?

Note You need to log in before you can comment on or make changes to this bug.