[Marble-commits] KDE/kdeedu/marble/src/lib
Bastian Holst
bastianholst at gmx.de
Sun Dec 20 22:30:11 CET 2009
SVN commit 1064404 by bholst:
Prevent to call eventFilter of uninitialized Marble RenderPlugins. Fixes crash on enabling NavigationPlugin.
M +1 -0 LayerManager.cpp
M +5 -0 LayerManager.h
M +2 -0 MarbleModel.cpp
M +5 -0 MarbleModel.h
M +3 -0 MarbleWidget.cpp
M +5 -0 MarbleWidget.h
M +10 -1 MarbleWidgetInputHandler.cpp
M +2 -0 MarbleWidgetInputHandler.h
--- trunk/KDE/kdeedu/marble/src/lib/LayerManager.cpp #1064403:1064404
@@ -145,6 +145,7 @@
if ( !renderPlugin->isInitialized() )
{
renderPlugin->initialize();
+ emit renderPluginInitialized( renderPlugin );
}
renderPlugin->render( painter, viewport, renderPosition );
}
--- trunk/KDE/kdeedu/marble/src/lib/LayerManager.h #1064403:1064404
@@ -81,6 +81,11 @@
* @brief Signal that the number of floatItems has changed
*/
void floatItemsChanged();
+
+ /**
+ * @brief Signal that a render item has been initialized
+ */
+ void renderPluginInitialized( RenderPlugin *renderPlugin );
/**
* This signal is emitted when the settings of a plugin changed.
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1064403:1064404
@@ -206,6 +206,8 @@
this, SIGNAL( pluginSettingsChanged() ) );
connect ( d->m_layerManager, SIGNAL( repaintNeeded( QRegion ) ),
this, SIGNAL( repaintNeeded( QRegion ) ) );
+ connect ( d->m_layerManager, SIGNAL( renderPluginInitialized( RenderPlugin * ) ),
+ this, SIGNAL( renderPluginInitialized( RenderPlugin * ) ) );
d->m_timer = new QTimer( this );
d->m_timer->start( 200 );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.h #1064403:1064404
@@ -367,6 +367,11 @@
void downloadTile( const QUrl& sourceUrl, const QString& destinationFileName,
const QString& id ) const;
+
+ /**
+ * @brief Signal that a render item has been initialized
+ */
+ void renderPluginInitialized( RenderPlugin *renderPlugin );
private:
Q_DISABLE_COPY( MarbleModel )
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1064403:1064404
@@ -229,6 +229,9 @@
m_widget->connect( m_model, SIGNAL( pluginSettingsChanged() ),
m_widget, SIGNAL( pluginSettingsChanged() ) );
+
+ m_widget->connect( m_model, SIGNAL( renderPluginInitialized( RenderPlugin * ) ),
+ m_widget, SIGNAL( renderPluginInitialized( RenderPlugin * ) ) );
}
// ----------------------------------------------------------------
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.h #1064403:1064404
@@ -976,6 +976,11 @@
* This signal is emit when the settings of a plugin changed.
*/
void pluginSettingsChanged();
+
+ /**
+ * @brief Signal that a render item has been initialized
+ */
+ void renderPluginInitialized( RenderPlugin *renderPlugin );
protected:
/**
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetInputHandler.cpp #1064403:1064404
@@ -95,9 +95,13 @@
{
d->m_widget = w;
d->m_model = w->model();
+
+ connect( d->m_widget, SIGNAL( renderPluginInitialized( RenderPlugin * ) ),
+ this, SLOT( installPluginEventFilter( RenderPlugin * ) ) );
foreach( RenderPlugin *renderPlugin, d->m_widget->renderPlugins() ) {
- d->m_widget->installEventFilter( renderPlugin );
+ if( renderPlugin->isInitialized() )
+ d->m_widget->installEventFilter( renderPlugin );
}
}
@@ -219,6 +223,11 @@
}
}
+void MarbleWidgetInputHandler::installPluginEventFilter( RenderPlugin *renderPlugin )
+{
+ d->m_widget->installEventFilter( renderPlugin );
+}
+
void MarbleWidgetDefaultInputHandler::init( MarbleWidget *w )
{
MarbleWidgetInputHandler::init( w );
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidgetInputHandler.h #1064403:1064404
@@ -34,6 +34,7 @@
class MarbleMap;
class MarbleWidgetPopupMenu;
class AbstractDataPluginItem;
+class RenderPlugin;
class MARBLE_EXPORT MarbleWidgetInputHandler : public QObject
{
@@ -71,6 +72,7 @@
protected Q_SLOTS:
void restoreViewContext();
+ void installPluginEventFilter( RenderPlugin *renderPlugin );
protected:
class Protected;
More information about the Marble-commits
mailing list