https://bugs.kde.org/show_bug.cgi?id=503813

--- Comment #28 from Igor Kushnir <igor...@gmail.com> ---
If SwitchToBuddyPlugin::contextMenuExtension() does not enter a nested event
loop, it does not need a QPointer guard. Rather it should never be invoked in
the first place if the menu object is destroyed within
GitPlugin::additionalMenuEntries().

I think the QPointer guards for the QMenu objects are needed:
1) in GitPlugin::additionalMenuEntries();
2) in DistributedVersionControlPlugin::contextMenuExtension() - checked after
the additionalMenuEntries() call, which may enter a nested event loop;
3) in PluginController::queryPluginsForContextMenuExtensions() - checked after
each contextMenuExtension() call (not sure about the calls after the loop, such
as debugControllerInternal()->contextMenuExtension(), depends on whether they
can enter a nested event loop);
4) in TextDocument::populateContextMenu() - checked after the call to
queryPluginsForContextMenuExtensions().

Hopefully the rest of the call stack does not care if the menu object is
destroyed.

This need for patching-up in multiple places illustrates why nested event loops
are best avoided. But if the KTextEditor interface that emits the context menu
signal does not allow asynchronous population of the menu, then avoiding nested
event loops would require a new KTextEditor interface...

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to