mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[Plugins] Added possibility to unregister scheme handlers.
It is important to unregister scheme handler when unloading a plugin, otherwise it will crash on next createRequest call.
This commit is contained in:
parent
c073ce0094
commit
901bdac85d
@ -608,6 +608,15 @@ bool NetworkManager::registerSchemeHandler(const QString &scheme, SchemeHandler*
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NetworkManager::unregisterSchemeHandler(const QString &scheme, SchemeHandler* handler)
|
||||||
|
{
|
||||||
|
if (!m_schemeHandlers.contains(scheme) || m_schemeHandlers[scheme] != handler) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_schemeHandlers.remove(scheme) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkManager::saveCertificates()
|
void NetworkManager::saveCertificates()
|
||||||
{
|
{
|
||||||
Settings settings;
|
Settings settings;
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
NetworkProxyFactory* proxyFactory() const;
|
NetworkProxyFactory* proxyFactory() const;
|
||||||
|
|
||||||
bool registerSchemeHandler(const QString &scheme, SchemeHandler* handler);
|
bool registerSchemeHandler(const QString &scheme, SchemeHandler* handler);
|
||||||
|
bool unregisterSchemeHandler(const QString &scheme, SchemeHandler* handler);
|
||||||
|
|
||||||
void disconnectObjects();
|
void disconnectObjects();
|
||||||
|
|
||||||
|
@ -81,5 +81,6 @@ private:
|
|||||||
|
|
||||||
#define QZ_REGISTER_EVENT_HANDLER(Type) mApp->plugins()->registerAppEventHandler(Type, this);
|
#define QZ_REGISTER_EVENT_HANDLER(Type) mApp->plugins()->registerAppEventHandler(Type, this);
|
||||||
#define QZ_REGISTER_SCHEME_HANDLER(Scheme, Object) mApp->networkManager()->registerSchemeHandler(Scheme, Object);
|
#define QZ_REGISTER_SCHEME_HANDLER(Scheme, Object) mApp->networkManager()->registerSchemeHandler(Scheme, Object);
|
||||||
|
#define QZ_UNREGISTER_SCHEME_HANDLER(Scheme, Object) mApp->networkManager()->unregisterSchemeHandler(Scheme, Object);
|
||||||
|
|
||||||
#endif // PLUGINPROXY_H
|
#endif // PLUGINPROXY_H
|
||||||
|
Loading…
Reference in New Issue
Block a user