Bug 141546

Summary: unable to load a chm file in okular
Product: [Applications] okular Reporter: Kunal Thakar <kunalt>
Component: CHM backendAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Crash report

Description Kunal Thakar 2007-02-11 19:50:26 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

Open a chm file in okular (I have tried to open chm files with images). Okular crashes.

The crash report is as follows:
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1234098512 (LWP 25543)]
[KCrash handler]
#6  0xb606df04 in khtmlImLoad::Image::notifyPerformUpdate (this=0x8bbcfb0)
    at /home/kunal/ldata/kde4/kdelibs/khtml/imload/image.cpp:81
#7  0xb606d52d in khtmlImLoad::Updater::pushUpdates (this=0x860b2e8)
    at /home/kunal/ldata/kde4/kdelibs/khtml/imload/updater.cpp:67
#8  0xb606d5cd in khtmlImLoad::Updater::qt_metacall (this=0x860b2e8, 
    _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfc2ccb8)
    at /home/kunal/ldata/kde4/kdelibs-build/khtml/updater.moc:64
#9  0xb7f5a431 in QMetaObject::activate (sender=0x8637780, 
    from_signal_index=4, to_signal_index=4, argv=0x0)
    at kernel/qobject.cpp:2937
#10 0xb7f5a804 in QMetaObject::activate (sender=0x8637780, m=0xb7fc01e4, 
    local_signal_index=0, argv=0x0) at kernel/qobject.cpp:2983
#11 0xb7f80325 in QTimer::timeout (this=0x8637780)
    at .moc/debug-shared/moc_qtimer.cpp:123
#12 0xb7f6594e in QTimer::timerEvent (this=0x8637780, e=0xbfc2d640)
    at kernel/qtimer.cpp:238
#13 0xb7f5af74 in QObject::event (this=0x8637780, e=0xbfc2d640)
    at kernel/qobject.cpp:995
#14 0xb6d764a9 in QApplicationPrivate::notify_helper (this=0x8054e70, 
    receiver=0x8637780, e=0xbfc2d640) at kernel/qapplication.cpp:3434
#15 0xb6d767d9 in QApplication::notify (this=0xbfc2f130, receiver=0x8637780, 
    e=0xbfc2d640) at kernel/qapplication.cpp:3009
#16 0xb7bd0d0d in KApplication::notify (this=0xbfc2f130, receiver=0x8637780, 
    event=0xbfc2d640)
    at /home/kunal/ldata/kde4/kdelibs/kdeui/kernel/kapplication.cpp:292
#17 0xb7f4bad5 in QCoreApplication::sendEvent (receiver=0x8637780, 
    event=0xbfc2d640) at kernel/qcoreapplication.h:183
#18 0xb7f720de in timerSourceDispatch (source=0x8060c00)
    at kernel/qeventdispatcher_glib.cpp:189
#19 0xb690d802 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#20 0xb69107df in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#21 0xb6910d45 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#22 0xb7f718b0 in QEventDispatcherGlib::processEvents (this=0x805f378, 
    flags=@0xbfc2d7a8) at kernel/qeventdispatcher_glib.cpp:363
#23 0xb6e063a8 in QGuiEventDispatcherGlib::processEvents (this=0x805f378, 
    flags=@0xbfc2d7d8) at kernel/qguieventdispatcher_glib.cpp:178
#24 0xb7f4a300 in QCoreApplication::processEvents (flags=@0xbfc2d820, 
    maxtime=50) at kernel/qcoreapplication.cpp:683
#25 0xb5853a3b in CHMGenerator::preparePageForSyncOperation (this=0x8375d08, 
    zoom=100, url=@0x835aea8)
    at /home/kunal/ldata/kde4/graphics/okular/generators/chm/generator_chm.cpp:90
#26 0xb5853e33 in CHMGenerator::loadDocument (this=0x8375d08, 
    fileName=@0x8124688, pagesVector=@0x8110c00)
    at /home/kunal/ldata/kde4/graphics/okular/generators/chm/generator_chm.cpp:61
#27 0xb64c7df3 in Okular::Document::openDocument (this=0x8125208, 
    docFile=@0x8124688, url=@0xbfc2db38, _mime=@0xbfc2db98)
    at /home/kunal/ldata/kde4/graphics/okular/core/document.cpp:776
#28 0xb651b9e6 in Part::openFile (this=0x8124660)
    at /home/kunal/ldata/kde4/graphics/okular/part.cpp:635
#29 0xb779ee72 in KParts::ReadOnlyPart::openUrl (this=0x8124660, 
    url=@0xbfc2dd68) at /home/kunal/ldata/kde4/kdelibs/kparts/part.cpp:359
#30 0xb651b616 in Part::openUrl (this=0x8124660, url=@0xbfc2dd68)
    at /home/kunal/ldata/kde4/graphics/okular/part.cpp:731
#31 0x0804ed2b in Shell::openUrl (this=0x80fe2a0, url=@0xbfc2dd68, page=0)
    at /home/kunal/ldata/kde4/graphics/okular/shell/shell.cpp:134
#32 0x0804eedb in Shell::fileOpen (this=0x80fe2a0)
    at /home/kunal/ldata/kde4/graphics/okular/shell/shell.cpp:281
#33 0x0804f423 in Shell::qt_metacall (this=0x80fe2a0, 
    _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0xbfc2e2cc)
    at /home/kunal/ldata/kde4/graphics-build/okular/shell/shell.moc:87
#34 0xb7f5a431 in QMetaObject::activate (sender=0x82ac060, 
    from_signal_index=5, to_signal_index=6, argv=0xbfc2e2cc)
    at kernel/qobject.cpp:2937
#35 0xb7f5a5ca in QMetaObject::activate (sender=0x82ac060, m=0xb72d7488, 
    from_local_signal_index=1, to_local_signal_index=2, argv=0xbfc2e2cc)
    at kernel/qobject.cpp:2992
#36 0xb6d6ee6e in QAction::triggered (this=0x82ac060, _t1=false)
    at .moc/debug-shared/moc_qaction.cpp:208
#37 0xb6d7080c in QAction::activate (this=0x82ac060, event=QAction::Trigger)
    at kernel/qaction.cpp:1070
#38 0xb6d74291 in QAction::trigger (this=0x82ac060)
    at ../../include/QtGui/../../src/gui/kernel/qaction.h:175
#39 0xb7108c13 in QToolButton::nextCheckState (this=0x82cb1e8)
    at widgets/qtoolbutton.cpp:1005
#40 0xb7054a83 in QAbstractButtonPrivate::click (this=0x82cbe70)
    at widgets/qabstractbutton.cpp:500
#41 0xb7054d68 in QAbstractButton::mouseReleaseEvent (this=0x82cb1e8, 
    e=0xbfc2e9c8) at widgets/qabstractbutton.cpp:1076
#42 0xb710a0a0 in QToolButton::mouseReleaseEvent (this=0x82cb1e8, 
    e=0xbfc2e9c8) at widgets/qtoolbutton.cpp:604
#43 0xb6dc3311 in QWidget::event (this=0x82cb1e8, event=0xbfc2e9c8)
    at kernel/qwidget.cpp:5698
#44 0xb70536f7 in QAbstractButton::event (this=0x82cb1e8, e=0xbfc2e9c8)
    at widgets/qabstractbutton.cpp:1038
#45 0xb7108bbe in QToolButton::event (this=0x82cb1e8, e=0xbfc2e9c8)
    at widgets/qtoolbutton.cpp:1011
#46 0xb6d764a9 in QApplicationPrivate::notify_helper (this=0x8054e70, 
    receiver=0x82cb1e8, e=0xbfc2e9c8) at kernel/qapplication.cpp:3434
#47 0xb6d77014 in QApplication::notify (this=0xbfc2f130, receiver=0x82cb1e8, 
    e=0xbfc2e9c8) at kernel/qapplication.cpp:3133
#48 0xb7bd0d0d in KApplication::notify (this=0xbfc2f130, receiver=0x82cb1e8, 
    event=0xbfc2e9c8)
    at /home/kunal/ldata/kde4/kdelibs/kdeui/kernel/kapplication.cpp:292
#49 0xb6d7f629 in QCoreApplication::sendSpontaneousEvent (receiver=0x82cb1e8, 
    event=0xbfc2e9c8)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:186
#50 0xb6ddd768 in QETWidget::translateMouseEvent (this=0x82cb1e8, 
    event=0xbfc2ee8c) at kernel/qapplication_x11.cpp:3666
#51 0xb6ddb062 in QApplication::x11ProcessEvent (this=0xbfc2f130, 
    event=0xbfc2ee8c) at kernel/qapplication_x11.cpp:2764
#52 0xb6e06b0b in x11EventSourceDispatch (s=0x8060c48, callback=0, 
    user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:122
#53 0xb690d802 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#54 0xb69107df in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#55 0xb6910d45 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#56 0xb7f718b0 in QEventDispatcherGlib::processEvents (this=0x805f378, 
    flags=@0xbfc2f028) at kernel/qeventdispatcher_glib.cpp:363
#57 0xb6e063a8 in QGuiEventDispatcherGlib::processEvents (this=0x805f378, 
    flags=@0xbfc2f05c) at kernel/qguieventdispatcher_glib.cpp:178
#58 0xb7f46d0e in QEventLoop::processEvents (this=0xbfc2f0d0, 
    flags=@0xbfc2f094) at kernel/qeventloop.cpp:126
#59 0xb7f46e90 in QEventLoop::exec (this=0xbfc2f0d0, flags=@0xbfc2f0d8)
    at kernel/qeventloop.cpp:168
#60 0xb7f4a209 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:727
#61 0xb6d7602c in QApplication::exec () at kernel/qapplication.cpp:2927
#62 0x0804da2b in main (argc=135258696, argv=0x0)
    at /home/kunal/ldata/kde4/graphics/okular/shell/main.cpp:83
Comment 1 Kunal Thakar 2007-02-11 19:52:10 UTC
Created attachment 19620 [details]
Crash report
Comment 2 Albert Astals Cid 2007-02-11 20:40:34 UTC
Can we have the file that is causing the crash please?
Comment 3 Kunal Thakar 2007-02-12 18:10:01 UTC
I have uploaded the file to http://kunalt.googlepages.com/chmfiles
Comment 4 Tobias Koenig 2007-02-13 18:25:29 UTC
On Sun, Feb 11, 2007 at 06:50:28PM -0000, Kunal Thakar wrote:
> ------- You are receiving this mail because: -------

Hi Kunal,

> [KCrash handler]
> #6  0xb606df04 in khtmlImLoad::Image::notifyPerformUpdate (this=0x8bbcfb0)
>     at /home/kunal/ldata/kde4/kdelibs/khtml/imload/image.cpp:81
> #7  0xb606d52d in khtmlImLoad::Updater::pushUpdates (this=0x860b2e8)
>     at /home/kunal/ldata/kde4/kdelibs/khtml/imload/updater.cpp:67
> #8  0xb606d5cd in khtmlImLoad::Updater::qt_metacall (this=0x860b2e8, 
>     _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfc2ccb8)
>     at /home/kunal/ldata/kde4/kdelibs-build/khtml/updater.moc:64

This bug is caused by a race condition deep inside khtml... I contacted
the khtml developer, lets hope that they can provide a fix soon.

Ciao,
Tobias
Comment 5 Tobias Koenig 2007-02-19 21:47:58 UTC
SVN commit 635326 by tokoe:

Unregister Image from Updater in dtor to avoid crashes

BUG:141546


 M  +1 -0      image.cpp  
 M  +11 -0     updater.cpp  
 M  +3 -0      updater.h  


--- trunk/KDE/kdelibs/khtml/imload/image.cpp #635325:635326
@@ -52,6 +52,7 @@
 
 Image::~Image()
 {
+    ImageManager::updater()->unregisterImage(this);
     delete   loader;
     delete   original;
     assert(scaled.isEmpty());
--- trunk/KDE/kdelibs/khtml/imload/updater.cpp #635325:635326
@@ -53,6 +53,17 @@
     frames[schedulePortion].append(frame);
 }
 
+void Updater::unregisterImage(Image* frame)
+{
+    QVector<Image*>::const_iterator iter;
+    for (int i = 0; i < 10; ++i)
+    {
+        int pos = frames[i].indexOf(frame);
+        if (pos != -1)
+          frames[i].remove(pos);
+    }
+}
+
 void Updater::pushUpdates()
 {
     timePortion++;
--- trunk/KDE/kdelibs/khtml/imload/updater.h #635325:635326
@@ -51,6 +51,9 @@
      amount of time has passed.
      */
     void haveUpdates(Image* frame);
+
+    void unregisterImage(Image* frame);
+
 private Q_SLOTS:
     void pushUpdates();
 private: