fix a previewmap-related QObject::disconnect segfault
authorsheepluva
Thu, 03 May 2012 02:45:08 +0200
changeset 7008 25563f054ef3
parent 7005 19cddb42326f
child 7011 f6f09a0954ea
fix a previewmap-related QObject::disconnect segfault
QTfrontend/ui/widget/mapContainer.cpp
QTfrontend/ui/widget/mapContainer.h
--- a/QTfrontend/ui/widget/mapContainer.cpp	Thu May 03 01:18:29 2012 +0200
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Thu May 03 02:45:08 2012 +0200
@@ -297,6 +297,7 @@
     pMap = new HWMap();
     connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
     connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
+    connect(pMap, SIGNAL(destroyed(QObject *)), this, SLOT(onPreviewMapDestroyed(QObject *)));
     pMap->getImage(m_seed,
                    getTemplateFilter(),
                    get_mapgen(),
@@ -602,3 +603,10 @@
     }
 
 }
+
+
+void HWMapContainer::onPreviewMapDestroyed(QObject * map)
+{
+    if (map == pMap)
+        pMap = 0;
+}
--- a/QTfrontend/ui/widget/mapContainer.h	Thu May 03 01:18:29 2012 +0200
+++ b/QTfrontend/ui/widget/mapContainer.h	Thu May 03 02:45:08 2012 +0200
@@ -73,6 +73,7 @@
         void setDrawnMapData(const QByteArray & ar);
         void setAllMapParameters(const QString & map, MapGenerator m, int mazesize, const QString & seed, int tmpl);
         void updateModelViews();
+        void onPreviewMapDestroyed(QObject * map);
 
     signals:
         void seedChanged(const QString & seed);