[Marble-devel] Re: Problem with map creation

Torsten Rahn tackat at t-online.de
Mon Jun 13 01:37:04 CEST 2011


Hi Helmut,

On Monday, 13. June 2011 00:21:09 Mülner, Helmut wrote:
> I think I found the cause of the problem (but no solution):
> It is a data race condition caused by the QFileSystemWatcher which results
> in a rebuild of the m_mapThemeModel in
> MapThemeManager::updateMapThemeModel() which leads to undeterministic
> chaos, made worse by the existance of 3 (three!) MapThemeManagers, see:

Yes, we at one point until recently we had suddenly two (as described in the 
comments), which surely is not optimal. Now it's even three. Really odd.

I agree we need to clean this up for the release.


> C:\source\marble-trunk\marble\src\ControlView.cpp(80):   
> m_mapThemeManager = new MapThemeManager;

This one looks odd: At least from looking quickly at the code the 
MapThemeManager inside ControlView is only used for one particular method: 

ControlView::defaultMapThemeId()

And that method only gets called when there is no previous map theme saved 
into the settings. So this map theme manager instance is only used at the very 
first Marble startup. Therefore it makes no sense to always instantiate it and 
to keep it around for the whole lifetime of the ControlView object. So I guess 
the lifetime of this one should get reduced to the call of 
defaultMapThemeId(). We need to check whether instantiating and deleting it 
inside defaultMapThemeId() works well.

(This instance might be here since originally the idea might have been to pass 
the MapThemeManager instance to the widget from the outside - but nowadays 
that's obviously not the case anymore ... ) .


> C:\source\marble-trunk\marble\src\lib\MapViewWidget.cpp(162):       
> d->m_mapThemeManager = new MapThemeManager();

Looking at the code I wonder why we don't just take the MapThemeManager from 
MarbleModel. But there might be a reason - we need to check this. 


> C:\source\marble-trunk\marble\src\lib\MarbleModel.cpp(82):         
> m_mapThemeManager( new MapThemeManager( parent )),


 
> In my local version I have removed the two duplicates (but broken the API),
> but this does not help, because the sequence of events depends on the
> behaviour of the QFileSystemWatcher and the speed and other
> characteristics of the filesystem.
> 
> Here the relevant stack traces:
>  marblewidgetd.dll!Marble::MapThemeManager::updateMapThemeModel()  Line 297
> C++ marblewidgetd.dll!Marble::MapThemeManager::directoryChanged(const
> QString & path)  Line 323 C++
> marblewidgetd.dll!Marble::MapThemeManager::qt_metacall(QMetaObject::Call
> _c, int _id, void * * _a)  Line 82 + 0xf bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> QtCored4.dll!QFileSystemWatcher::directoryChanged(const QString & _t1) 
> Line 102 + 0x14 bytes C++
> QtCored4.dll!QFileSystemWatcherPrivate::_q_directoryChanged(const QString
> & path, bool removed)  Line 359 C++
> QtCored4.dll!QFileSystemWatcher::qt_metacall(QMetaObject::Call _c, int
> _id, void * * _a)  Line 86 C++ QtCored4.dll!QMetaObject::metacall(QObject
> * object, QMetaObject::Call cl, int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> QtCored4.dll!QFileSystemWatcherEngine::directoryChanged(const QString &
> _t1, bool _t2)  Line 95 + 0x14 bytes C++
> QtCored4.dll!QFileSystemWatcherEngine::qt_metacall(QMetaObject::Call _c,
> int _id, void * * _a)  Line 79 C++
> QtCored4.dll!QWindowsFileSystemWatcherEngine::qt_metacall(QMetaObject::Cal
> l _c, int _id, void * * _a)  Line 64 + 0x14 bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaCallEvent::placeMetaCall(QObject * object)  Line 535 +
> 0x19 bytes C++ QtCored4.dll!QObject::event(QEvent * e)  Line 1217 + 0x14
> bytes C++ QtGuid4.dll!QApplicationPrivate::notify_helper(QObject *
> receiver, QEvent * e)  Line 4462 + 0x11 bytes C++
> QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e)  Line
> 3862 + 0x10 bytes C++
> QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent *
> event)  Line 731 + 0x15 bytes C++
> QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent *
> event)  Line 215 + 0x39 bytes C++
> QtCored4.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver,
> int event_type, QThreadData * data)  Line 1372 + 0xd bytes C++
> QtCored4.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message,
> unsigned int wp, long lp)  Line 497 + 0x10 bytes C++ user32.dll!75a562fa()
>   [Frames below may be incorrect and/or missing, no symbols loaded for
> user32.dll] user32.dll!75a56d3a()
>   user32.dll!75a56ce9()
>   user32.dll!75a577c4()
>   user32.dll!75a5788a()
>   QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum
> QEventLoop::ProcessEventsFlag> flags)  Line 813 C++
> QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum
> QEventLoop::ProcessEventsFlag> flags)  Line 1170 + 0x15 bytes C++
> QtCored4.dll!QEventLoop::processEvents(QFlags<enum
> QEventLoop::ProcessEventsFlag> flags)  Line 150 C++
> QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag>
> flags)  Line 201 + 0x2d bytes C++ QtGuid4.dll!QDialog::exec()  Line 553
> C++
>   marblewidgetd.dll!Marble::MarbleMap::setMapThemeId(const QString &
> mapThemeId)  Line 830 + 0x15 bytes C++
> marblewidgetd.dll!Marble::MarbleWidget::setMapThemeId(const QString &
> mapThemeId)  Line 847 C++
> marblewidgetd.dll!Marble::MarbleWidget::qt_metacall(QMetaObject::Call _c,
> int _id, void * * _a)  Line 302 + 0xf bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> marblewidgetd.dll!Marble::MapViewWidget::selectMapTheme(const QString &
> _t1)  Line 109 + 0x17 bytes C++
> marblewidgetd.dll!Marble::MapViewWidget::qt_metacall(QMetaObject::Call _c,
> int _id, void * * _a)  Line 89 + 0xf bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> marblewidgetd.dll!Marble::MarbleThemeSelectView::selectMapTheme(const
> QString & _t1)  Line 108 + 0x17 bytes C++
> marblewidgetd.dll!Marble::MarbleThemeSelectView::selectedMapTheme(QModelIn
> dex index)  Line 159 C++
> marblewidgetd.dll!Marble::MarbleThemeSelectView::qt_metacall(QMetaObject::
> Call _c, int _id, void * * _a)  Line 91 + 0x29 bytes C++ ...
> 
>  marblewidgetd.dll!Marble::MapViewWidget::selectTheme(const QString &
> theme)  Line 201 C++ theme = earth/plain/plain.dgml
> marblewidgetd.dll!Marble::MapViewWidget::updateMapThemeView()  Line 176
> C++ marblewidgetd.dll!Marble::MapViewWidget::qt_metacall(QMetaObject::Call
> _c, int _id, void * * _a)  Line 96 + 0x8 bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> QtCored4.dll!QAbstractItemModel::rowsInserted(const QModelIndex & _t1, int
> _t2, int _t3)  Line 181 + 0x14 bytes C++
> QtCored4.dll!QAbstractItemModel::endInsertRows()  Line 2413 C++
>   QtGuid4.dll!QStandardItemModelPrivate::rowsInserted(QStandardItem *
> parent, int row, int count)  Line 559 C++
> QtGuid4.dll!QStandardItemPrivate::insertRows(int row, int count, const
> QList<QStandardItem *> & items)  Line 434 C++
> QtGuid4.dll!QStandardItem::insertRow(int row, const QList<QStandardItem *>
> & items)  Line 1458 C++ QtGuid4.dll!QStandardItem::appendRow(const
> QList<QStandardItem *> & aitems)  Line 302 + 0x1c bytes C++
> QtGuid4.dll!QStandardItemModel::appendRow(const QList<QStandardItem *> &
> items)  Line 2464 C++
> marblewidgetd.dll!Marble::MapThemeManager::updateMapThemeModel()  Line 308
> + 0x14 bytes C++
> marblewidgetd.dll!Marble::MapThemeManager::directoryChanged(const QString
> & path)  Line 323 C++
> marblewidgetd.dll!Marble::MapThemeManager::qt_metacall(QMetaObject::Call
> _c, int _id, void * * _a)  Line 82 + 0xf bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> QtCored4.dll!QFileSystemWatcher::directoryChanged(const QString & _t1) 
> Line 102 + 0x14 bytes C++
> QtCored4.dll!QFileSystemWatcherPrivate::_q_directoryChanged(const QString
> & path, bool removed)  Line 359 C++
> QtCored4.dll!QFileSystemWatcher::qt_metacall(QMetaObject::Call _c, int
> _id, void * * _a)  Line 86 C++ QtCored4.dll!QMetaObject::metacall(QObject
> * object, QMetaObject::Call cl, int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> QtCored4.dll!QFileSystemWatcherEngine::directoryChanged(const QString &
> _t1, bool _t2)  Line 95 + 0x14 bytes C++
> QtCored4.dll!QFileSystemWatcherEngine::qt_metacall(QMetaObject::Call _c,
> int _id, void * * _a)  Line 79 C++
> QtCored4.dll!QWindowsFileSystemWatcherEngine::qt_metacall(QMetaObject::Cal
> l _c, int _id, void * * _a)  Line 64 + 0x14 bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaCallEvent::placeMetaCall(QObject * object)  Line 535 +
> 0x19 bytes C++ QtCored4.dll!QObject::event(QEvent * e)  Line 1217 + 0x14
> bytes C++ QtGuid4.dll!QApplicationPrivate::notify_helper(QObject *
> receiver, QEvent * e)  Line 4462 + 0x11 bytes C++
> QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e)  Line
> 3862 + 0x10 bytes C++
> QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent *
> event)  Line 731 + 0x15 bytes C++
> QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent *
> event)  Line 215 + 0x39 bytes C++
> QtCored4.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver,
> int event_type, QThreadData * data)  Line 1372 + 0xd bytes C++
> QtCored4.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message,
> unsigned int wp, long lp)  Line 497 + 0x10 bytes C++ user32.dll!75a562fa()
>   [Frames below may be incorrect and/or missing, no symbols loaded for
> user32.dll] user32.dll!75a56d3a()
>   user32.dll!75a56ce9()
>   user32.dll!75a577c4()
>   user32.dll!75a5788a()
>   QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum
> QEventLoop::ProcessEventsFlag> flags)  Line 813 C++
> QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum
> QEventLoop::ProcessEventsFlag> flags)  Line 1170 + 0x15 bytes C++
> QtCored4.dll!QEventLoop::processEvents(QFlags<enum
> QEventLoop::ProcessEventsFlag> flags)  Line 150 C++
> QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag>
> flags)  Line 201 + 0x2d bytes C++ QtGuid4.dll!QDialog::exec()  Line 553
> C++
>   marblewidgetd.dll!Marble::MarbleMap::setMapThemeId(const QString &
> mapThemeId)  Line 830 + 0x15 bytes C++
> marblewidgetd.dll!Marble::MarbleWidget::setMapThemeId(const QString &
> mapThemeId)  Line 847 C++
> marblewidgetd.dll!Marble::MarbleWidget::qt_metacall(QMetaObject::Call _c,
> int _id, void * * _a)  Line 302 + 0xf bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> marblewidgetd.dll!Marble::MapViewWidget::selectMapTheme(const QString &
> _t1)  Line 109 + 0x17 bytes C++
> marblewidgetd.dll!Marble::MapViewWidget::qt_metacall(QMetaObject::Call _c,
> int _id, void * * _a)  Line 89 + 0xf bytes C++
> QtCored4.dll!QMetaObject::metacall(QObject * object, QMetaObject::Call cl,
> int idx, void * * argv)  Line 238 C++
> QtCored4.dll!QMetaObject::activate(QObject * sender, const QMetaObject *
> m, int local_signal_index, void * * argv)  Line 3278 + 0x27 bytes C++
> marblewidgetd.dll!Marble::MarbleThemeSelectView::selectMapTheme(const
> QString & _t1)  Line 108 + 0x17 bytes C++
> marblewidgetd.dll!Marble::MarbleThemeSelectView::selectedMapTheme(QModelIn
> dex index)  Line 159 C++ ...
> 
> Best regards,
> Helmut Mülner
> _______________________________________________
> Marble-devel mailing list
> Marble-devel at kde.org
> https://mail.kde.org/mailman/listinfo/marble-devel


More information about the Marble-devel mailing list