WebKit crashes when fast zooming in/out in Google Maps (Qt 5.2, Windows 7)



  • Hi

    Qt is 5.2.0, with MinGW 4.8, downloaded from Qt website as precompiled)
    System is Windows7, 64bit

    I'm writing an application which should include Google Maps. However, I got constantly crashes which looks like that Google Maps is not fast enough for providing Data.
    I could reproduce the problem with the debugger and got the following printout:
    @
    QPainter::begin: Paint device returned engine == 0, type: 2
    ASSERTION FAILED: m_ptr
    ..\WTF/wtf/OwnPtr.h(72) : WTF::OwnPtr<T>::ValueType* WTF::OwnPtr<T>::operator->() const [with T = WebCore::ImageBuffer; WTF::OwnPtr<T>::PtrType = WebCore::ImageBuffer*; WTF::OwnPtr<T>::ValueType = WebCore::ImageBuffer]
    @

    The stack shows the following (all in file Qt\5.2.0\minw48_32\bin\QtWebKitd.dll)
    @

    0 WTFCrash C:\Qt\5.2.0\mingw48_32\bin\Qt5WebKitd.dll 0x189a9be5
    1 WebCore::BitmapTextureImageBuffer::updateContents(WebCore::TextureMapper*, WebCore::GraphicsLayer*, WebCore::IntRect const&, WebCore::IntPoint const&, WebCore::BitmapTexture::UpdateContentsFlag) C:\Qt\5.2.0\mingw48_32\bin\Qt5WebKitd.dll 0x181857de
    2 WebCore::TextureMapperTile::updateContents(WebCore::TextureMapper*, WebCore::GraphicsLayer*, WebCore::IntRect const&, WebCore::BitmapTexture::UpdateContentsFlag) C:\Qt\5.2.0\mingw48_32\bin\Qt5WebKitd.dll 0x1817f7fa
    3 _fu2170___ZTVN10__cxxabiv120__si_class_type_infoE C:\Qt\5.2.0\mingw48_32\bin\Qt5WebKitd.dll 0x1a8d1f08
    4 ?? 0x38b1a308
    @

    The constructor which calles the WebView looks as follow:
    @
    MapView::MapView(CGPX_File *gpxFile,QWidget *parent) :
    QWebView(parent)
    {

    m_GPXFile = gpxFile;
    QDir dir;
    QString path = dir.absolutePath();
    QString htmlfile = "file:///"+path+"/map_html/map.html";
    qDebug()<<"HTML: "+htmlfile;
    

    this->load(QUrl(htmlfile));

    }
    @

    map.html is as follows:

    (I had to remove the < before script, otherwise the lines were not visible in the preview
    @
    <html>
    <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=yes" />
    script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.1&sensor=true"> /script>
    script type="text/javascript">
    var map;
    var Parkimage;
    var CurPosImage;
    var flightPath;

    var markersArray = [];
    var parkingArray = [];
    var positionArray = [];
    var CurPositionArray = [];

    var trackArray = [];

    var currentMarker;
    function initialize()
    {

    var latlng = new google.maps.LatLng(48.397,9.644);
    var myOptions =
    {
        zoom:8,
        center:latlng,
        mapTypeId:google.maps.MapTypeId.ROADMAP,
        draggable: true
     };
        map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
        Parkimage = 'parkplatz.jpg';
        CurPosImage = 'Flag.png';
        google.maps.event.addListener(map, 'click', function(event) {
          placePosition(event.latLng);
        });
        flightPath = new google.maps.Polyline({
           strokeColor: '#FF0000',
           strokeOpacity: 1.0,
           strokeWeight: 3
         });
    
         flightPath.setMap(map);
    
    }
    

    [removed]
    </head>
    <body >
    <div id="map_canvas" ></div>
    <input id="MyPosition" type="hidden">
    </body>
    </html>

    @

    Checking the Internet for that problem, I found the following:

    http://developer.nokia.com/community/wiki/QPainter::begin:Paint_device_returned_engine_==0(Known_Issue)

    However, I have no idea how to set this with QWebView.



  • Hi there, we've got the same issue with Qt 5.x up to 5.3.2 now. Were you able to resolve? Otherwise perhaps we can help one another.

    Cheers!



  • Try RELEASE mode, DEBUG mode causes crashs



  • I narrowed it down to the use of Ground Overlays (https://developers.google.com/maps/documentation/javascript/groundoverlays). I am rendering a custom image, writing it to local storage, and passing a file URL to the map. It works just fine, but when zooming in or out quickly, the issue occurs. Generally, the app runs out of memory, which seems to suggest a memory leak in the Ground Overlay implementation.

    As far as I have seen, removing the ground overlay during zooming (upon "zoom_changed" event) has eliminated the issue, but it's awkward for the overlay to disappear, then reappear once the map is idle again ("idle" event). So I'm looking for another workaround.



  • [quote author="krekeltronics" date="1413569611"]Hi there, we've got the same issue with Qt 5.x up to 5.3.2 now. Were you able to resolve? Otherwise perhaps we can help one another.

    Cheers![/quote]

    Sorry, I didn't made much more with this. This was only a hobby project to write my own GPX-Viewer, so I was not able (and also willing :-) ) to do a lot of investigation there. Maybe I will port it to Linux and see what will happen there, but I work on this only from time to time, so this could mean that it will be a long time until I work on it again.
    From my work side (the one I get paid for), I do nothing with Windows



  • I am looking into porting our implementation to use the new QtWebEngine, but haven't yet figured out how to get the JavaScript to talk to the C++. It used to use addToJavaScriptWindowObject on the frame, but I think it would use QtWebChannel now.



  • I am still finding this consistently with Windows 7/8 and Mac OS X 10.9/10.10.x and Qt 5.4rc, both release and debug. I'm not sure I have any choice any more short of migrating away from Qt (that would be bad) or trying Qt WebEngine (and finding a way for the JS and C++ functions to talk to each other).



  • I am still finding this consistently with Windows 7/8 and Mac OS X 10.9/10.10.x and Qt 5.4rc, both release and debug. I'm not sure I have any choice any more short of migrating away from Qt (that would be bad) or trying Qt WebEngine (and finding a way for the JS and C++ functions to talk to each other).


  • Lifetime Qt Champion

    Hi,

    Did you already saw the "porting guide":http://qt-project.org/wiki/QtWebEnginePortingFromQtWebKit ?

    Hope it helps


  • Lifetime Qt Champion

    Hi,

    Did you already saw the "porting guide":http://qt-project.org/wiki/QtWebEnginePortingFromQtWebKit ?

    Hope it helps



  • Thanks, that guide was useful in my initial port, but without addToJavaScriptWindowObject I need to find a different way to be able to call C++ from the JS side (sockets, I am guessing).



  • Thanks, that guide was useful in my initial port, but without addToJavaScriptWindowObject I need to find a different way to be able to call C++ from the JS side (sockets, I am guessing).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.