Commit 288c92e1 authored by Milian Wolff's avatar Milian Wolff
Browse files

don't store raw pointer to AbstractNavigationContext, use the KSharedPtr to prevent crashes

TODO: how can this be backported to 4.2 without breaking the ABI?
AbstractNavigationContext is an exported class and I changed the type of
m_previousContext... Is this OK?

BUG: 266116
parent 24ce7aa9
......@@ -164,7 +164,7 @@ NavigationContextPointer AbstractNavigationContext::execute(NavigationAction& ac
break;
case NavigationAction::NavigateDeclaration:
{
AbstractDeclarationNavigationContext* ctx = dynamic_cast<AbstractDeclarationNavigationContext*>(m_previousContext);
AbstractDeclarationNavigationContext* ctx = dynamic_cast<AbstractDeclarationNavigationContext*>(m_previousContext.data());
if( ctx && ctx->declaration() == action.decl )
return NavigationContextPointer( m_previousContext );
return AbstractNavigationContext::registerChild(action.decl);
......
......@@ -170,7 +170,7 @@ class KDEVPLATFORMLANGUAGE_EXPORT AbstractNavigationContext : public KShared
QMap<QString, NavigationAction> m_links;
QMap<int, int> m_linkLines; //Holds the line for each link
QMap<int, NavigationAction> m_intLinks;
AbstractNavigationContext* m_previousContext;
NavigationContextPointer m_previousContext;
QString m_prefix, m_suffix;
KDevelop::TopDUContextPointer m_topContext;
......
......@@ -53,10 +53,10 @@ struct NavigationAction {
type = JumpToSource;
}
NavigationAction(AbstractNavigationContext* _targetContext) : targetContext(_targetContext) {
NavigationAction(KSharedPtr<AbstractNavigationContext> _targetContext) : targetContext(_targetContext) {
}
AbstractNavigationContext* targetContext; //If this is set, this action does nothing else than jumping to that context
KSharedPtr<AbstractNavigationContext> targetContext; //If this is set, this action does nothing else than jumping to that context
DeclarationPointer decl;
Type type;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment