From 38057f79cf8f04a7239e5c75b71f2e5ee024d554 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Thu, 25 Apr 2013 21:18:33 +0100 Subject: [PATCH] Fix 2 Google Map SEGV .. webBridge crash in QtWebKit for 4.8.4 (qt-bug 30403) .. delete GoogleMap leaves webBridge orphaned which will crash if intervals are created or removed. We need a proper fix for the webkit issue which we will get when we migrate to Qt5. --- src/GoogleMapControl.cpp | 14 +++++++++++++- src/GoogleMapControl.h | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/GoogleMapControl.cpp b/src/GoogleMapControl.cpp index 9379e64b7..dedf83a64 100644 --- a/src/GoogleMapControl.cpp +++ b/src/GoogleMapControl.cpp @@ -64,6 +64,11 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcChartWindow(mw), main(mw) first = true; } +GoogleMapControl::~GoogleMapControl() +{ + delete webBridge; +} + void GoogleMapControl::rideSelected() { @@ -437,6 +442,7 @@ GoogleMapControl::createMarkers() laststoptime = rfp->secs; } + // // INTERVAL MARKERS // @@ -452,12 +458,17 @@ GoogleMapControl::createMarkers() " var marker = new google.maps.Marker({ title: '%3', animation: google.maps.Animation.DROP, position: latlng });" " marker.setMap(map);" " markerList.push(marker);" // keep track of those suckers +#if 0 " google.maps.event.addListener(marker, 'click', function(event) { webBridge.toggleInterval(%4); });" +#endif "}") .arg(myRideItem->ride()->dataPoints()[offset]->lat,0,'g',GPS_COORD_TO_STRING) .arg(myRideItem->ride()->dataPoints()[offset]->lon,0,'g',GPS_COORD_TO_STRING) .arg(x.name) - .arg(interval); +#if 0 + .arg(interval) +#endif + ; view->page()->mainFrame()->evaluateJavaScript(code); interval++; } @@ -600,6 +611,7 @@ WebBridge::drawOverlays() void WebBridge::toggleInterval(int x) { +return; IntervalItem *current = dynamic_cast(mainWindow->allIntervalItems()->child(x)); if (current) current->setSelected(!current->isSelected()); } diff --git a/src/GoogleMapControl.h b/src/GoogleMapControl.h index f9a9c76f2..bd25055d8 100644 --- a/src/GoogleMapControl.h +++ b/src/GoogleMapControl.h @@ -86,7 +86,7 @@ class GoogleMapControl : public GcChartWindow public: GoogleMapControl(MainWindow *); - virtual ~GoogleMapControl() {} + ~GoogleMapControl(); bool first; public slots: