Bug 109764 - kpdf crashes on logout if it has a file open
Summary: kpdf crashes on logout if it has a file open
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
: 110613 111886 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-28 14:28 UTC by Robin Green
Modified: 2005-09-29 21:45 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch that could fix it (4.06 KB, patch)
2005-09-01 19:28 UTC, Albert Astals Cid
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Green 2005-07-28 14:28:10 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    RedHat RPMs
Compiler:          gcc version 4.0.1 20050720 (Red Hat 4.0.1-4) 
OS:                Linux

When I log out, the KDE crash handler appears and gives the following backtrace for kpdf:

Using host libthread_db library "/lib/libthread_db.so.1".
`system-supplied DSO at 0xfd4000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1208186432 (LWP 23031)]
[KCrash handler]
#4  QGList::find (this=0x0, d=0xb9912c, fromStart=true) at tools/qglist.cpp:745
#5  0x00a9095b in KGlobal::registerStaticDeleter (obj=0xb9912c)
    at qptrlist.h:95
#6  0x00a26b3f in KSharedConfig (this=0xb6e06eb8, fileName=@0x0,
    readonly=false, usekdeglobals=true) at kstaticdeleter.h:109
#7  0x00a26c6b in KSharedConfig::openConfig (fileName=@0xbfbed004,
    immutable=false, useKDEGlobals=true) at kconfig.cpp:347
#8  0x00afe1db in KConfigSkeleton (this=0xb6e06e18, configname=@0xbfbed004)
    at kconfigskeleton.cpp:888
#9  0x00f03f37 in Settings (this=0xb6e06e18) at settings.cpp:22
#10 0x00f09e1e in Settings::self () at settings.cpp:14
#11 0x00e630bf in ~Part (this=0x8d162a8) at settings.h:288
#12 0x053b425e in QPtrList<QObject>::deleteItem (this=0x8d13bd0, d=0x8d162a8)
    at qptrlist.h:150
#13 0x04dadb1d in QGList::clear (this=0x8d13bd0) at tools/qglist.cpp:701
#14 0x00a9b333 in ~KLibrary (this=0x8d13b98) at qptrlist.h:93
#15 0x00a9c66d in KLibLoader::close_pending (this=0x8d115e8, wrap=0x0)
    at klibloader.cpp:516
#16 0x00a9ca93 in ~KLibLoader (this=0x8d115e8) at klibloader.cpp:328
#17 0x00a9a3fd in KLibLoader::cleanUp () at klibloader.cpp:298
#18 0x009fbfc9 in ~KApplication (this=0xbfbed524) at kapplication.cpp:1627
#19 0x0804eecc in main (argc=0, argv=0x0) at main.cpp:80
#20 0x0035941f in __libc_start_main (main=0x804ec70 <main>, argc=3,
    ubp_av=0xbfbed6e4, init=0x80506c4 <__libc_csu_init>,
    fini=0x8050714 <__libc_csu_fini>, rtld_fini=0x334c7d <_dl_fini>,
    stack_end=0xbfbed6dc) at ../sysdeps/generic/libc-start.c:231
#21 0x0804ebe1 in _start ()
Comment 1 Enrico Ros 2005-07-28 15:09:19 UTC
This seems a duplicate of the already fixed "Settings" crash.
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Con Tele2 risparmi al telefono e su Internet. Sempre. Clicca qui per conoscere le promozioni
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3757&d=28-7
Comment 2 Philippe Rigault 2005-07-28 18:32:56 UTC
Confirmed on KDE 3.4.2 . Same backtrace.

> This seems a duplicate of the already fixed "Settings" crash. 
BugID ?

It is clearly not fixed in 3.4 branch. 
Comment 3 Albert Astals Cid 2005-07-28 18:35:50 UTC
Well, that is quite a bold statement, i really can not reproduce that problem with kpdf 3.4.2.
Comment 4 Philippe Rigault 2005-07-29 00:27:09 UTC
100% reproducible here.
KPDF doe not need to have a file open, by the way.

Just open KPDF, log out of KDE -> crash.

KDE 3.4.2 compiled from sources (using konstruct).
GCC-3.4.3-22 on Fedora Core 3 x86_64

Debugdialog (output in .xsession-errors):
<snip>
ksmserver: completeShutdown: client kwin(1021224b1dd18a000112258897900000160160000)
ksmserver: completeShutdown: client (1021224b1dd18a000112258897900000160160001)
ksmserver: completeShutdown: client kdesktop(1021224b1dd18a000112258897900000160160003)
ksmserver: completeShutdown: client kicker(1021224b1dd18a000112258897900000160160004)
ksmserver: completeShutdown: client klipper(1021224b1dd18a000112258898000000160160005)
ksmserver: completeShutdown: client korgac(1021224b1dd18a000112258898000000160160006)
ksmserver: completeShutdown: client knotify(1021224b1dd18a000112258898000000160160007)
ksmserver: completeShutdown: client kpdf(1021224b1dd18a000112258898400000160160008)
ksmserver:  We killed all clients. We have now clients.count()=8
ksmserver: KSMServer::completeKilling clients.count()=8
ksmserver: KSMServer::completeKilling clients.count()=7
kdecore (KLibLoader): The KLibLoader contains the library libkpdfpart (0x750f20)
kdecore (KLibLoader): Factory still has object 0x758de0 unnamed Library = libkpdfpart
kdecore (KConfigSkeleton): Creating KConfigSkeleton (0x8cd660)
kdecore (KAction): KActionCollection::~KActionCollection(): this = 0x856f00
kdecore (KAccel): ~KAccel(): this = 0x85c500
kdecore (KAccel): ~KAccelBase(): this = 0x8560b0
kdecore (KAccel): 	KAccelActions::clear()
kdecore (KAction): KAction::slotDestroyed(): this = 0x85d7d0, name = "toggleUrlGrabAction", sender = 0x85c500
kdecore (KAction): KAction::slotDestroyed(): this = 0x85e4e0, name = "clearHistoryAction", sender = 0x85c500
kdecore (KAction): KAction::slotDestroyed(): this = 0x85ebc0, name = "configureAction", sender = 0x85c500
kdecore (KAction): KAction::slotDestroyed(): this = 0x85f1f0, name = "quitAction", sender = 0x85c500
kdecore (KAction): KAction::~KAction( this = "toggleUrlGrabAction" )
kdecore (KAction): KAction::~KAction( this = "clearHistoryAction" )
kdecore (KAction): KAction::~KAction( this = "configureAction" )
kdecore (KAction): KAction::~KAction( this = "quitAction" )
kdecore (KAccel): ~KGlobalAccel(): this = 0x865c20
kdecore (KAccel): ~KAccelBase(): this = 0x863908
kdecore (KAccel): 	KAccelActions::clear()
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kpdf path = <unknown> pid = 16047
ksmserver: KSMServer::completeKilling clients.count()=6
DCOP: unregister 'kpdf-16047'
<snip>
Comment 5 Philippe Rigault 2005-07-29 02:58:11 UTC
It happens on my 32-bit (i686) build of 3.4.2 too.
Just so we rule that it is 64-bit specific.
Comment 6 Philippe Rigault 2005-07-29 03:59:23 UTC
Opps, typo.

Just so we rule OUT a 64-bit specific bug. 
Comment 7 Albert Astals Cid 2005-09-01 17:49:15 UTC
*** Bug 110613 has been marked as a duplicate of this bug. ***
Comment 8 Albert Astals Cid 2005-09-01 18:36:25 UTC
*** Bug 111886 has been marked as a duplicate of this bug. ***
Comment 9 Hugo Costelha 2005-09-01 18:55:02 UTC
Well, the description in bug 110613, reported by Juan Pedro Paredes, pretty much says where the problem seems to be.
Comment 10 Albert Astals Cid 2005-09-01 19:07:01 UTC
Any of you is able of testing a patch against kde 3.5 branch?
Comment 11 Enrico Ros 2005-09-01 19:08:45 UTC
Just a note from today's chat between Albert and me, to help collecting thoughts:
[18:48] TSDgeos: because i just got 3 reports like that in a few days
[18:49] TSDgeos: searched for that fix you mention and don't remember it
[18:49] Koral: aahh! the infamous "Settings" stuff ?
[18:49] TSDgeos: yeah
[18:50] TSDgeos: wondering why it does not crash here
[18:50] TSDgeos: and if we really fixed it
[18:50] Koral: I referred to when Settings was renamed to KpdfSettings. that could have prevented more errors like this one..
[18:51] TSDgeos: ah
[18:51] TSDgeos: no, i think it's different
[18:51] Koral: Before the Settings class was renamed, I found that it could mean something and
[18:52] Koral: In annotations I removed all Settings:: call in destructors
[18:52] Koral: becouse I found that KStaticDeleter deleted the Setting class (from the KPART) BEFORE the DESTRUCTORS of classes
[18:52] TSDgeos: where did you place the one about the splitters?
[18:53] Koral: when the splitter is moved I think
[18:53] Koral: (when it's dropped)
[18:53] TSDgeos: ok, let's see if that helps
Comment 12 Albert Astals Cid 2005-09-01 19:28:35 UTC
Created attachment 12449 [details]
Patch that could fix it

If anyone could test this patch (against 3.5 branch) and tell me if it works it
would be great
Comment 13 Albert Astals Cid 2005-09-04 10:24:05 UTC
Dirk any chance you could reproduce it and the patch works for you?
Comment 14 Dirk Mueller 2005-09-06 14:36:07 UTC
Albert: No, I'm unable to reproduce the crash (3.4branch). I just subscribed because it was reported in Novell bugzilla as well, so I can backport the fix when its done. 

Comment 15 Juan Pedro Paredes 2005-09-27 21:32:49 UTC
The patch works great for me.
I can do dcop logout.
Later all is restored.
Comment 16 Albert Astals Cid 2005-09-29 21:45:37 UTC
SVN commit 465437 by aacid:

Don't use KpdfSettings from the destructor as it seems to cause some problems for users, should fix bug 109764
BUGS: 109764


 M  +21 -5     part.cpp  
 M  +3 -0      part.h  
 M  +4 -0      ui/pageview.cpp  
 M  +1 -0      ui/thumbnaillist.cpp  


--- branches/KDE/3.5/kdegraphics/kpdf/part.cpp #465436:465437
@@ -267,6 +267,9 @@
 		splitterSizes.push_back( 500 );
 	}
 	m_splitter->setSizes( splitterSizes );
+	// get notified about splitter size changes (HACK that will be removed
+	// by connecting to Qt4::QSplitter's sliderMoved())
+	m_pageView->installEventFilter( this );
 	m_watcher = new KDirWatch( this );
 	connect( m_watcher, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileDirty( const QString& ) ) );
 	m_dirtyHandler = new QTimer( this );
@@ -277,6 +280,7 @@
 	// [SPEECH] check for KTTSD presence and usability
 	KTrader::OfferList offers = KTrader::self()->query("DCOP/Text-to-Speech", "Name == 'KTTSD'");
 	KpdfSettings::setUseKTTSD( (offers.count() > 0) );
+	KpdfSettings::writeConfig();
 
 	// set our XML-UI resource file
 	setXMLFile("part.rc");
@@ -285,11 +289,6 @@
 
 Part::~Part()
 {
-    // save internal settings
-    KpdfSettings::setSplitterSizes( m_splitter->sizes() );
-    // write to disk config file
-    KpdfSettings::writeConfig();
-
     delete m_document;
     if ( --m_count == 0 )
         delete globalParams;
@@ -475,10 +474,21 @@
     return KParts::ReadOnlyPart::closeURL();
 }
 
+bool Part::eventFilter( QObject * watched, QEvent * e )
+{
+    // if pageView has been resized, save splitter sizes
+    if ( watched == m_pageView && e->type() == QEvent::Resize )
+        saveSplitterSize();
+
+    // only intercept events, don't block them
+    return false;
+}
+
 void Part::slotShowLeftPanel()
 {
     bool showLeft = m_showLeftPanel->isChecked();
     KpdfSettings::setShowLeftPanel(showLeft);
+    KpdfSettings::writeConfig();
     // show/hide left qtoolbox
     m_leftPanel->setShown( showLeft );
     // this needs to be hidden explicitly to disable thumbnails gen
@@ -572,6 +582,12 @@
 	KMessageBox::information(widget(), i18n("This link points to a quit application action that does not work when using the embedded viewer."), QString::null, "warnNoQuitIfNotInKPDF");
 }
 
+void Part::saveSplitterSize()
+{
+    KpdfSettings::setSplitterSizes( m_splitter->sizes() );
+    KpdfSettings::writeConfig();
+} 
+
 //BEGIN go to page dialog
 class KPDFGotoPageDialog : public KDialogBase
 {
--- branches/KDE/3.5/kdegraphics/kpdf/part.h #465436:465437
@@ -86,6 +86,8 @@
 	bool openFile();
 	bool openURL(const KURL &url);
 	bool closeURL();
+  // filter that watches for splitter size changes
+  bool eventFilter( QObject * watched, QEvent * e );
 
 protected slots:
 	void openURLFromDocument(const KURL &url);
@@ -114,6 +116,7 @@
 	void enableTOC(bool enable);
 	void psTransformEnded();
 	void cannotQuit();
+  void saveSplitterSize();
 	void setMimeTypes(KIO::Job *job);
 
 public slots:
--- branches/KDE/3.5/kdegraphics/kpdf/ui/pageview.cpp #465436:465437
@@ -1097,6 +1097,7 @@
                         {
                             d->messageWindow->display( i18n("Starting KTTSD Failed: %1").arg(error) );
                             KpdfSettings::setUseKTTSD(false);
+                            KpdfSettings::writeConfig();
                         }
                     }
                     if ( KpdfSettings::useKTTSD() )
@@ -1444,6 +1445,7 @@
         // save selected zoom factor
         KpdfSettings::setZoomMode(newZoomMode);
         KpdfSettings::setZoomFactor(newFactor);
+        KpdfSettings::writeConfig();
     }
 }
 
@@ -1913,6 +1915,7 @@
     if ( KpdfSettings::viewColumns() != newColumns )
     {
         KpdfSettings::setViewColumns( newColumns );
+        KpdfSettings::writeConfig();
         if ( d->document->pages() > 0 )
             slotRelayoutPages();
     }
@@ -1923,6 +1926,7 @@
     if ( KpdfSettings::viewContinuous() != on )
     {
         KpdfSettings::setViewContinuous( on );
+        KpdfSettings::writeConfig();
         if ( d->document->pages() > 0 )
             slotRelayoutPages();
     }
--- branches/KDE/3.5/kdegraphics/kpdf/ui/thumbnaillist.cpp #465436:465437
@@ -247,6 +247,7 @@
 {
     // save state
     KpdfSettings::setFilterBookmarks( filterOn );
+    KpdfSettings::writeConfig();
     // ask for the 'notifySetup' with a little trick (on reinsertion the
     // document sends the list again)
     m_document->removeObserver( this );