h1aji / chmsee

CHM viewer
GNU General Public License v2.0
1 stars 1 forks source link

Freeze on File Exit #85

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Platform: Ubuntu 9.10 Karmic
Software version: git 4a3b7fe80cb625c5467635e82b1f0de576424a17 (2010-06-12)

chmsee freezes on exit if a .chm file was loaded, every time.

This does not happen on Ubuntu 10.04 Lucid.

To reproduce:

Using a .chm file, such as 
http://download.macromedia.com/pub/robohelp/files/downloads/htmlhelp/access_test
.zip :
$ chmsee some_file.chm
Choose File > Exit, or click the Close Window button in the corner of the 
window.
Chmsee freezes, with no output in the console.

Attaching with gdb didn't seem to give much helpful information. The back trace 
shows chmsee_quit here, if this is any help:
...
#114 0x0077966f in g_object_run_dispose () from /usr/lib/libgobject-2.0.so.0
#115 0x00272bce in gtk_object_destroy () from /usr/lib/libgtk-x11-2.0.so.0
#116 0x08054be0 in chmsee_quit ()
#117 0x007849fc in g_cclosure_marshal_VOID__VOID () from 
/usr/lib/libgobject-2.0.so.0
...

Original issue reported on code.google.com by strobert@gmail.com on 15 Jun 2010 at 8:07

GoogleCodeExporter commented 8 years ago
I can't reproduce this problem on the Debian Sid, I don't have a ubuntu system.
Could you paste the full output with chmsee -vvv command?

Original comment by jungl...@gmail.com on 21 Jun 2010 at 7:57

GoogleCodeExporter commented 8 years ago
On Ubuntu 9.10 Karmic, with git a5be08a2b5f117ad156f5eac09ff593da6d1489b 
2010-06-21:

Some added debugging output showed me:

chmsee.c:329 chmsee_dispose calling chmsee_parent_class dispose
book.c:331 cs_book_dispose calling cs_book_parent_class dispose
bookmarks.c:164 end of cs_bookmarks_finalize
And then it wasn't clear if it ever returned to chmsee code.

chmsee with -vvv gives:

$ chmsee access_test.chm -vvv
** Message: Main >>> load config
** (chmsee:11490): DEBUG: Main >>> chmsee config file path = 
/home/user/.chmsee/config
** Message: CS_HTML_GECKO >>> init gecko system
** (chmsee:11490): DEBUG: GECKO_UTILS >>> initialization finished.
** (chmsee:11490): DEBUG: CS_BOOK >>> create
** (chmsee:11490): DEBUG: Chmsee >>> populate window finished.
** Message: Chmsee >>> created
** Message: Chmsee >>> open file = access_test.chm
** (chmsee:11490): DEBUG: CS_CHMFILE >>> priv->chm = access_test.chm, 
priv->page = (null)
** (chmsee:11490): DEBUG: CS_CHMFILE >>> book folder = 
/home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6
** (chmsee:11490): DEBUG: CS_CHMFILE >>> read bookinfo file = 
/home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/chmsee_bookinfo
** (chmsee:11490): DEBUG: CS_CHMFILE >>> priv->hhc = /access_test.hhc
** (chmsee:11490): DEBUG: CS_CHMFILE >>> priv->hhk = /access_test.hhk
** (chmsee:11490): DEBUG: CS_CHMFILE >>> priv->hhk p= 0x8ca83b0
** (chmsee:11490): DEBUG: CS_CHMFILE >>> priv->homepage = /welcome.htm
** (chmsee:11490): DEBUG: CS_CHMFILE >>> priv->bookname = ms_acces
** (chmsee:11490): DEBUG: CS_CHMFILE >>> priv->endcoding = ISO-8859-1
** (chmsee:11490): DEBUG: CS_PARSER >>> SAX.startDocument()
** (chmsee:11490): DEBUG: CS_PARSER >>> SAX.endDocument()
** (chmsee:11490): DEBUG: CS_PARSER >>> Parsing file 
/home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/access_test.hhc 
finished
** (chmsee:11490): DEBUG: CS_PARSER >>> SAX.startDocument()
** (chmsee:11490): DEBUG: CS_PARSER >>> SAX.endDocument()
** (chmsee:11490): DEBUG: CS_PARSER >>> Parsing file 
/home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/access_test.hhk 
finished
** (chmsee:11490): DEBUG: CS_BOOKMARKS_FILE >>> load bookmarks file = 
/home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/chmsee_bookmarks
** (chmsee:11490): DEBUG: CS_BOOK >>> set model, file = 0x89aa148
** (chmsee:11490): DEBUG: CS_CHMFILE >>> get variable font
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> set variable font Sans 12
** (chmsee:11490): DEBUG: CS_CHMFILE >>> get fixed font
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> set fixed font Monospace 12
** (chmsee:11490): DEBUG: CS_TOC >>> create
** (chmsee:11490): DEBUG: CS_INDEX >>> create
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> create
** (chmsee:11490): DEBUG: CS_TREEVIEW >>> apply filter model
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> selection changed
** (chmsee:11490): DEBUG: CS_INDEX >>> set model
** (chmsee:11490): DEBUG: CS_TREEVIEW >>> set model
** (chmsee:11490): DEBUG: CS_BOOKMARKS >>> create
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> create
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> selection changed
** (chmsee:11490): DEBUG: CS_BOOKMARKS >>> set model
** (chmsee:11490): DEBUG: CS_TREEVIEW >>> set model
** (chmsee:11490): DEBUG: CS_BOOK >>> cs_book_new_tab
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> child add callback
** (chmsee:11490): DEBUG: CS_BOOK >>> enter switch page callback
** (chmsee:11490): DEBUG: CS_BOOK >>> switch page new_page_num = 0, new_page = 
0x8cb5678
** (chmsee:11490): DEBUG: CS_BOOK >>> switch page callback, set active_html = 
(nil)
** (chmsee:11490): DEBUG: CS_BOOK >>> Reload current page
** (chmsee:11490): DEBUG: CS_BOOK >>> new tab html_notebook append page = 0
** (chmsee:11490): DEBUG: CS_BOOK >>> load uri /welcome.htm
** (chmsee:11490): DEBUG: CS_BOOK >>> load uri html = 0x8cb5678, full_uri = 
file:///home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/welcome.htm
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> load_url html = 0x8cb5678, uri = 
file:///home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/welcome.htm
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> send location changed signal, 
location = about:blank
** (chmsee:11490): DEBUG: CS_BOOK >>> html location changed cb: about:blank
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> send open-uri signal, uri = 
file:///home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/welcome.htm
** Message: CS_BOOK >>> load url return 1
** (chmsee:11490): DEBUG: CS_TOC >>> sync uri /welcome.htm
** (chmsee:11490): DEBUG: CS_TOC >>> found data->uri: welcome.htm
** (chmsee:11490): DEBUG: CS_TOC >>> found link->uri: welcome.htm
** (chmsee:11490): DEBUG: Chmsee >>> receive book model changed callback (null)
** (chmsee:11490): DEBUG: Chmsee >>> update window title ms_acces - ChmSee
** (chmsee:11490): DEBUG: Chmsee >>> record last file =  access_test.chm

(chmsee:11490): Gtk-CRITICAL **: gtk_recent_manager_add_full: assertion `uri != 
NULL' failed
** (chmsee:11490): DEBUG: Chmsee >>> on_window_state_event with 
event->changed_mask = 1 and event->new_window_state = 0
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> send location changed signal, 
location = 
file:///home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/welcome.htm
** (chmsee:11490): DEBUG: CS_BOOK >>> html location changed cb: 
file:///home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/welcome.htm
** (chmsee:11490): DEBUG: Chmsee >>> recieve html_changed signal
** (chmsee:11490): DEBUG: CS_BOOK >>> html title changed cb title = welcome
** (chmsee:11490): DEBUG: CS_BOOK >>> update tab title = welcome
** (chmsee:11490): DEBUG: CS_BOOK >>> html title changed cb location = 
file:///home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/welcome.htm
** (chmsee:11490): DEBUG: CS_BOOK >>> html title changed cb call get_short_uri
** (chmsee:11490): DEBUG: CS_BOOK >>> get short uri = welcome.htm
** (chmsee:11490): DEBUG: CS_BOOK >>> html title changed cb call 
set_current_link
** (chmsee:11490): DEBUG: CS_BOOKMARKS >>> set bookmarks entry text = welcome, 
length = 7
** (chmsee:11490): DEBUG: CS_BOOKMARKS >>> set current link = welcome.htm

Choosing File > Exit.

** (chmsee:11490): DEBUG: Chmsee >>> window destroy
** Message: Chmsee >>> quit
** Message: CS_HTML_GECKO >>> shutdown gecko system
** (chmsee:11490): DEBUG: Chmsee >>> dispose
** (chmsee:11490): DEBUG: CS_HTML_GECKO >>> child remove callback
** (chmsee:11490): DEBUG: CS_BOOK >>> dispose
** (chmsee:11490): DEBUG: CS_CHMFILE >>> update bookmarks bookmarks_list
** (chmsee:11490): DEBUG: CS_BOOKMARKS_FILE >>> save bookmarks file = 
/home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/chmsee_bookmarks
** (chmsee:11490): DEBUG: CS_CHMFILE >>> finalize
** (chmsee:11490): DEBUG: CS_CHMFILE >>> save bookinfo file = 
/home/user/.chmsee/bookshelf/44991fe10ff1ac6c68bf2f698e3c8bc6/chmsee_bookinfo
** (chmsee:11490): DEBUG: CS_CHMFILE >>> finalized
** (chmsee:11490): DEBUG: CS_TOC >>> dispose
** (chmsee:11490): DEBUG: CS_TOC >>> dispose
** (chmsee:11490): DEBUG: CS_TOC >>> finalize
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> dispose
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> dispose
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> finalize
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> dispose
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> dispose
** (chmsee:11490): DEBUG: CS_TREE_VIEW >>> finalize
** (chmsee:11490): DEBUG: CS_BOOKMARKS >>> finalize
And it's frozen.

Running chmsee -vvv WITHOUT specifying a .chm file results in this output 
without freezing:

$ chmsee -vvv
** Message: Main >>> load config
** (chmsee:11523): DEBUG: Main >>> chmsee config file path = 
/home/user/.chmsee/config
** Message: CS_HTML_GECKO >>> init gecko system
** (chmsee:11523): DEBUG: GECKO_UTILS >>> initialization finished.
** (chmsee:11523): DEBUG: CS_BOOK >>> create
** (chmsee:11523): DEBUG: Chmsee >>> populate window finished.
** Message: Chmsee >>> created
** (chmsee:11523): DEBUG: Chmsee >>> on_window_state_event with 
event->changed_mask = 1 and event->new_window_state = 0

Choosing File > Exit.

** (chmsee:11523): DEBUG: Chmsee >>> window destroy
** Message: Chmsee >>> quit
** Message: CS_HTML_GECKO >>> shutdown gecko system
** (chmsee:11523): DEBUG: Chmsee >>> dispose
** (chmsee:11523): DEBUG: CS_BOOK >>> dispose
** (chmsee:11523): DEBUG: CS_BOOK >>> dispose
** (chmsee:11523): DEBUG: CS_BOOK >>> finalize
** (chmsee:11523): DEBUG: Chmsee >>> dispose
** (chmsee:11523): DEBUG: Chmsee >>> finalize
** Message: Main >>> save config
Didn't freeze, but exited successfully.

Original comment by strobert@gmail.com on 24 Jun 2010 at 9:16

GoogleCodeExporter commented 8 years ago
I modified the program destroy event processing, please retest it.

BTW, the git repository move to:

git://github.com/jungleji/chmsee.git

Original comment by jungl...@gmail.com on 28 Jun 2010 at 8:12

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Platform: Ubuntu 9.10 Karmic
Software version: git 2010-06-28 ee7dea4f084b5d1fb48fdf741ce7d2396eb1f587

It's still freezing, but I identified the commit that introduced the freezing.

After choosing File > Exit and before freezing, the output is identical as 
reported before except that this one line does not appear now:
** (chmsee:11490): DEBUG: Chmsee >>> window destroy

When running with no .chm file ("chmsee -vvv") (and thus not freezing) and 
choosing File > Exit, the output is identical as reported before except without 
this one line:
** (chmsee:11523): DEBUG: Chmsee >>> window destroy

It looks like the File > Exit freezing did not occur in 2010-05-04 77c4d94 but 
did occur by 2010-05-15 4e99820. chmsee segfaults loading a .chm in the three 
commits in between.

Reversing the change introduced in 2010-05-07 fa8738e, I can see that 
2010-05-14 d681df1 freezes and 2010-05-08 2d8f7bc freezes (but without 
segfaulting). So 2010-05-08 2d8f7bc probably introduced the freezing.

Furthermore, if I do this:
$ git reset --hard 4e99820
$ git revert -n 2d8f7bc # reverse the change introduced in 2010-05-08 2d8f7bc 
(and ignore that it has trouble with .po files)
$ rm po -rf; mkdir po # get it to build without po file conflicts
# Then I build and run chmsee, and choose File > Exit, it exits without 
freezing.

The above couple experiments lead me to believe that 2010-05-08 
2d8f7bc249ec0d91103f235630143308a81c96e3 introduced the freeze on File Exit.

Hopefully that's helpful.

Original comment by strobert@gmail.com on 2 Jul 2010 at 9:38

GoogleCodeExporter commented 8 years ago
The code in 2010-05-08 2d8f7bc introduced thread to chmsee to display a 
progress bar. 

This progress bar displaying function is only called during extracting chmfile 
to ~/.chmsee/bookshelf. If that chmfile is extracted before, this part of code 
will not be used. 

So, could you help to test chmsee with a same chmfile but do not clean up the 
~/.chmsee folder.

Original comment by jungl...@gmail.com on 5 Jul 2010 at 8:36

GoogleCodeExporter commented 8 years ago
Running
$ chmsee ~/access_test.chm
multiple times still results in a freeze each time without deleting the 
~/.chmsee folder. This is using chmsee at 2010-07-05 bf4c219.

I tried running the sample program, gtk-thread.c, at 
http://developer.gimp.org/api/2.0/gdk/gdk-Threads.html and it ran fine and was 
able to close the window without it freezing.

I tried commenting out parts of 2010-05-08 2d8f7bc to try to identify the 
problem, and found a surprising way to make it work, which also works in 
2010-07-05 bf4c219: by commenting out this line in src/main.c:
//        gdk_threads_init();
the freezing does not occur, and (in 2010-07-05 bf4c219) chmsee seems to work 
fine both when opening previously-opened .chm files and for new .chm files (ie 
deleting ~/.chmsee). That is rather unexpected, as I would have thought 
gdk_threads_enter would not work without gdk_threads_init. Maybe it just 
happens to work but is no-longer thread-safe.

Commenting out in src/main.c:
//        gtk_main();
also makes the program not freeze, but then it doesn't do much other than show 
the progress bar.

Anyway, so it seems that some code to make the program multi-threaded at all 
has caused the issue.

Original comment by strobert@gmail.com on 9 Jul 2010 at 10:36

GoogleCodeExporter commented 8 years ago
Thanks for your heavily testing. 
In order to find out the cause of this bug I installed an ubuntu 9.10 on my pc 
last weekend.

After debugging, I noticed if I comment out "cs_html_gecko_shutdown_system();" 
line 
in on_quit() fuction of chmsee.c, chmsee will quit no freeze. 
Inside "cs_html_gecko_shutdown_system()", chmsee call a gtkmozembed api 
"gtk_moz_embed_pop_startup()" to clean up xulrunner resource. 
If we drop this step, chmsee must cause some memory leak.

I also tested with gtkmoz/TestGtkEmbed.cpp, it has the same problem if I add 
"gdk_threads_init" into it's main() function.
It seems the xulrunner has some compatible problem with gthread 2.22, but works 
well on gthread 2.24.

I try to fix it, but still have no idea how to do with this, sorry.

Original comment by jungl...@gmail.com on 15 Jul 2010 at 3:05

GoogleCodeExporter commented 8 years ago
Set glib prerequisite to >= 2.24.

Original comment by jungl...@gmail.com on 13 Aug 2010 at 4:48