Bug 257376 - Runners involving network requests don't work anymore since Maemo's PR 1.3 update (Qt 4.6 => Qt 4.7)
Summary: Runners involving network requests don't work anymore since Maemo's PR 1.3 up...
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: 1.0 (KDE 4.6)
Assignee: Bernhard Beschow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-20 00:06 UTC by Dennis Nienhüser
Modified: 2013-04-07 11:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Nienhüser 2010-11-20 00:06:57 UTC
Version:           unspecified (using Devel) 
OS:                Linux

The PR 1.3 update on Maemo brought Qt 4.7, which uses this code qnetworkconfigmanager_p.cpp:

engine->moveToThread(QCoreApplicationPrivate::mainThread());

connect(engine, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations()));
connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer)));
connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer)));
connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)));

The problem here is that the engine is moved to the main thread and QNetworkConfigurationPrivatePointer is not registered using qregisterMetaType. This means that it is not possible to use a QNetworkAccessManager on Maemo in a thread, because the above signal/slot connection fails:

QObject::connect: Cannot queue arguments of type 'QNetworkConfigurationPrivatePointer'

I see two workarounds: 
1) Add the private class to Marble and register the metatype ourselves. This is pretty ugly since we had to distribute a private qt header.
2) Move the QNetworkAccessManager and its usage to the main thread. This is ugly as well since we go to a runner thread and from there on back to the main thread to do the work.

I'll go for 2) for now. It shouldn't be noticeable from the UI since the work done by the online runners is minimal. Still the patch should be reverted when the issue is fixed on the Qt side.


Reproducible: Didn't try
Comment 1 Dennis Nienhüser 2010-11-20 00:28:14 UTC
SVN commit 1198843 by nienhueser:

It's not possible to use QNetworkAccessManager in a thread on Maemo with Qt 4.7. This affects all online runners. Work around it by creating the instance and requests in the main thread. Should be reverted once the issue is fixed on the Qt side. See https://bugs.kde.org/show_bug.cgi?id=257376 for details.
CCBUG: 257376

 M  +3 -1      hostip/HostipPlugin.cpp  
 M  +33 -30    nominatim/OsmNominatimRunner.cpp  
 M  +11 -0     nominatim/OsmNominatimRunner.h  
 M  +14 -12    openrouteservice/OpenRouteServiceRunner.cpp  
 M  +6 -0      openrouteservice/OpenRouteServiceRunner.h  
 M  +14 -14    yours/YoursRunner.cpp  
 M  +4 -0      yours/YoursRunner.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1198843
Comment 2 Dennis Nienhüser 2011-04-15 21:51:16 UTC
The commit above fixed it.
Comment 3 Bernhard Beschow 2012-01-27 23:01:10 UTC
Git commit ce74cf2025066de0e72b97eb7ae5f408fa12da8f by Bernhard Beschow.
Committed on 20/01/2012 at 13:35.
Pushed by beschow into branch 'master'.

remove workaround for bug 257376

* the workaround shouldn't be needed any longer since commit 9e833bed58de665115ff9e2ea2c1e056144c288a
* bug 257376 was caused by QTBUG-15004

M  +6    -11   src/plugins/runner/hostip/HostipRunner.cpp
M  +0    -5    src/plugins/runner/hostip/HostipRunner.h
M  +14   -24   src/plugins/runner/nominatim/OsmNominatimRunner.cpp
M  +0    -6    src/plugins/runner/nominatim/OsmNominatimRunner.h
M  +9    -13   src/plugins/runner/openrouteservice/OpenRouteServiceRunner.cpp
M  +0    -7    src/plugins/runner/openrouteservice/OpenRouteServiceRunner.h
M  +5    -11   src/plugins/runner/yours/YoursRunner.cpp
M  +0    -4    src/plugins/runner/yours/YoursRunner.h

http://commits.kde.org/marble/ce74cf2025066de0e72b97eb7ae5f408fa12da8f
Comment 4 Dennis Nienhüser 2012-01-28 12:11:39 UTC
According to the Qt bug report Maemo won't get the Qt version that contains the patch. I didn't try it yet, but I guess we'll get crashes on Maemo again now.
Comment 5 Bernhard Beschow 2012-02-08 18:46:13 UTC
Git commit 24ca1226fcfa42e77e6ffeeadb31e6f3edf4c42a by Bernhard Beschow.
Committed on 08/02/2012 at 19:46.
Pushed by beschow into branch 'master'.

Revert "remove workaround for bug 257376"

This reverts commit ce74cf2025066de0e72b97eb7ae5f408fa12da8f.

M  +11   -6    src/plugins/runner/hostip/HostipRunner.cpp
M  +5    -0    src/plugins/runner/hostip/HostipRunner.h
M  +24   -14   src/plugins/runner/nominatim/OsmNominatimRunner.cpp
M  +6    -0    src/plugins/runner/nominatim/OsmNominatimRunner.h
M  +13   -9    src/plugins/runner/openrouteservice/OpenRouteServiceRunner.cpp
M  +7    -0    src/plugins/runner/openrouteservice/OpenRouteServiceRunner.h
M  +11   -5    src/plugins/runner/yours/YoursRunner.cpp
M  +4    -0    src/plugins/runner/yours/YoursRunner.h

http://commits.kde.org/marble/24ca1226fcfa42e77e6ffeeadb31e6f3edf4c42a
Comment 6 Bernhard Beschow 2012-12-13 21:06:29 UTC
Git commit 6a2887e11491ce775b580ba55ba21b397bc53a12 by Bernhard Beschow.
Committed on 13/12/2012 at 20:29.
Pushed by beschow into branch 'master'.

call QNetworkAccessManager::get() in the GUI thread

* this is done in the other runners as well

M  +12   -5    src/plugins/runner/open-source-routing-machine/OSRMRunner.cpp
M  +4    -0    src/plugins/runner/open-source-routing-machine/OSRMRunner.h

http://commits.kde.org/marble/6a2887e11491ce775b580ba55ba21b397bc53a12
Comment 7 Bernhard Beschow 2012-12-23 16:25:01 UTC
Git commit 54dbcdd91f9d8b811aef857adfa222d3c7979b13 by Bernhard Beschow.
Committed on 20/12/2012 at 13:12.
Pushed by beschow into branch 'master'.

instantiate runners in the GUI thread

This should finally privide a workaround for QTBUG-15004.
Networked plugins seem to work on the desktop under Qt 4.8.4, under Harmattan with Qt 4.7.4(?) and on Maemo 5 with the buggy Qt 4.7.0.

M  +4    -4    src/lib/MarbleRunnerManager.cpp
M  +27   -42   src/lib/RunnerTask.cpp
M  +8    -15   src/lib/RunnerTask.h

http://commits.kde.org/marble/54dbcdd91f9d8b811aef857adfa222d3c7979b13
Comment 8 Bernhard Beschow 2012-12-23 16:25:02 UTC
Git commit 2ff4179380c8a255381c984beaf178184b163405 by Bernhard Beschow.
Committed on 20/12/2012 at 13:31.
Pushed by beschow into branch 'master'.

call QNetworkAccessManager::get() in the GUI thread

* this is done in the other runners as well

M  +14   -4    src/plugins/runner/mapquest/MapQuestRunner.cpp
M  +4    -0    src/plugins/runner/mapquest/MapQuestRunner.h

http://commits.kde.org/marble/2ff4179380c8a255381c984beaf178184b163405
Comment 9 Bernhard Beschow 2013-01-15 18:27:51 UTC
Git commit a520e811ecede4e4f06e2e508f06c839a7230f3f by Bernhard Beschow.
Committed on 20/12/2012 at 13:31.
Pushed by beschow into branch 'KDE/4.10'.

call QNetworkAccessManager::get() in the GUI thread

* this is done in the other runners as well
(cherry picked from commit 2ff4179380c8a255381c984beaf178184b163405)

M  +14   -4    src/plugins/runner/mapquest/MapQuestRunner.cpp
M  +4    -0    src/plugins/runner/mapquest/MapQuestRunner.h

http://commits.kde.org/marble/a520e811ecede4e4f06e2e508f06c839a7230f3f
Comment 10 Bernhard Beschow 2013-03-05 18:00:50 UTC
*** Bug 278501 has been marked as a duplicate of this bug. ***