marten created this revision.
marten added reviewers: Frameworks, dfaure.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
marten requested review of this revision.

REVISION SUMMARY
  I've been looking at porting Konqueror's User Agent Changer plugin to current 
KF5.  The GUI is ported and working, but trying to change the user agent more 
than once in any given invocation of the browser does not seem to work.
  
  After changing the user agent string in kio_httprc, the plugin calls 
KIO::Scheduler::emitReparseSlaveConfiguration() to inform all running ioslaves 
of the change.  This first of all calls slotReparseSlaveConfiguration() 
directly to update in the current process, and then sets m_ignoreConfigReparse 
to true and emits the reparseSlaveConfiguration() signal.  The signal calls 
slotReparseSlaveConfiguration() via DBus;  when activated in the same process 
slotReparseSlaveConfiguration() ignores the signal because 
m_ignoreConfigReparse is set, it is reset to false and simply returns.
  
  However, it appears that the signal does not get looped back to the current 
process; in other words, slotReparseSlaveConfiguration() is not called via the 
DBus signal.  This means that m_ignoreConfigReparse is never reset to false 
and, the next time that KIO::Scheduler::emitReparseSlaveConfiguration() is 
called it has no effect.  This can be confirmed by uncommenting the "Ignoring 
signal sent by myself" debug line in slotReparseSlaveConfiguration(), the 
message is never printed.
  
  The change fixes this by explicitly setting m_ignoreConfigReparse to false 
before the direct call of slotReparseSlaveConfiguration(), then to true before 
the DBus call.  This inhibits the loopback signal in case it does happen, but 
ensures that the direct call is not ignored.

TEST PLAN
  Tested with https://kluge.in-chemnitz.de/tools/browser.php to show the user 
agent as sent.
  Observed that, with this fix, the user agent can be changed as many times as 
required.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D28647

AFFECTED FILES
  src/core/scheduler.cpp

To: marten, #frameworks, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns

Reply via email to