Commit 659ae73b authored by Enrico Ros's avatar Enrico Ros

Fixed crash when exiting with kapp->quit(). Usually the Settings singleton

is deleted after all classes, but when kpdf is run stand-alone and quit()
is used (currently only by clicking on Quit links) the app could crash.
-> Best practice: don't use KConfigXT settings classes for storing values
on destructors (do it when a parameter is updated).
CCMAIL: Mikolaj Machowski <mikmach@wp.pl>

svn path=/branches/kpdf_annotations/kdegraphics/kpdf/; revision=403765
parent e5ed6251
......@@ -111,6 +111,8 @@ Icons needed:
- COMMON (here in ToolBox): Toc, Annotations
Done (newest features come first):
-> FIX: random crash when closing kpdf with kapp->quit() (don't use Settings:: in destructors)
-> FIX: implement links for starting end exiting from presentation mode (pdf FullScreen, Close actions)
-> CHG: cursor wraps on screen for dragging the page/dynZooming
-> FIX: raised scaling performance by 10x times for typ usage, removed odd cases, speedups to viewScroll and dynZoom
-> ADD: annotations: complete xml storage/retrieval of internal annotations
......
......@@ -111,6 +111,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
// widgets: [] splitter []
m_splitter = new QSplitter( parentWidget, widgetName );
m_splitter->setOpaqueResize( true );
m_splitter->setChildrenCollapsible( false );
setWidget( m_splitter );
// widgets: [left panel] | []
......@@ -255,6 +256,10 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
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 );
......@@ -273,11 +278,6 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
Part::~Part()
{
// save internal settings
Settings::setSplitterSizes( m_splitter->sizes() );
// write to disk config file
Settings::writeConfig();
delete m_document;
if ( --m_count == 0 )
delete globalParams;
......@@ -385,6 +385,16 @@ bool Part::closeURL()
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 )
Settings::setSplitterSizes( m_splitter->sizes() );
// only intercept events, don't block them
return false;
}
void Part::slotShowLeftPanel()
{
bool showLeft = m_showLeftPanel->isChecked();
......
......@@ -81,6 +81,8 @@ protected:
bool openFile();
bool openURL(const KURL &url);
bool closeURL();
// filter that watches for splitter size changes
bool eventFilter( QObject * watched, QEvent * e );
protected slots:
// connected to actions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment