diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp
index 83c8ec397ee4ef01e4555c3a29815fca59a2a9c2..615ba5ec2aca73b7d88e68f149820c70c0153b7c 100644
--- a/src/plugins/bookmarks/bookmarksplugin.cpp
+++ b/src/plugins/bookmarks/bookmarksplugin.cpp
@@ -201,14 +201,18 @@ void BookmarksPlugin::updateActions(int state)
 
 void BookmarksPlugin::editorOpened(Core::IEditor *editor)
 {
-    connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
-            this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    if (qobject_cast<ITextEditor *>(editor)) {
+        connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
+                this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    }
 }
 
 void BookmarksPlugin::editorAboutToClose(Core::IEditor *editor)
 {
-    disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
-            this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    if (qobject_cast<ITextEditor *>(editor)) {
+        disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
+                this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    }
 }
 
 void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,