Not disposed pointer?


I am writing a new module builder for my plugin. In my module builder's setupRootModel-method, I am creating some new folders under the module source root. In one of those folders I am also creating a single file from a template. This all works fine: when the module is created, I see it in the editor (along with the new file which also looks fine).

However, every time when I close IntelliJ after adding my module type, I get an error about a 'not disposed pointer'. The error message points directly to my newly created file.

Here is my code to create the new file:

        final FileTemplateManager manager = FileTemplateManager.getInstance();
        final FileTemplate template = manager.getJ2eeTemplate(templateName);
        final PsiElement file = FileTemplateUtil.createFromTemplate(template, fileName, new Properties(), directory);

(copied from the existing Android plugin source code.)

This code is executed inside a WriteCommandAction, which in turn is executed inside a DumbAwareRunnable.

The stacktrace I get when closing IntelliJ:

[  20522]  ERROR - ij.components.ComponentManager - Not disposed pointer: listener=null: URL=file://D:/Projects/IdeaPluginTest/untitled/src/main/resources/my.xml
com.intellij.openapi.vfs.impl.VirtualFilePointerImpl$MyException: Not disposed pointer: listener=null: URL=file://D:/Projects/IdeaPluginTest/untitled/src/main/resources/my.xml
    at com.intellij.openapi.vfs.impl.VirtualFilePointerImpl.throwNotDisposedError(
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.assertPointersDisposed(
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.disposeComponent(
    at com.intellij.openapi.components.impl.ComponentManagerImpl.disposeComponents(
    at com.intellij.openapi.application.impl.ApplicationImpl.dispose(
    at com.intellij.openapi.util.Disposer$1.execute(
    at com.intellij.openapi.util.Disposer$1.execute(
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(
    at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(
    at com.intellij.openapi.util.objectTree.ObjectNode.execute(
    at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(
    at com.intellij.openapi.util.Disposer.dispose(
    at com.intellij.openapi.util.Disposer.dispose(
    at com.intellij.openapi.application.impl.ApplicationImpl.a(
    at com.intellij.openapi.application.impl.ApplicationImpl.access$400(
    at com.intellij.openapi.application.impl.ApplicationImpl$
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(
    at com.intellij.openapi.wm.impl.IdeFrameImpl$2$
    at com.intellij.openapi.application.impl.LaterInvocator$
    at java.awt.event.InvocationEvent.dispatch(
    at java.awt.EventQueue.dispatchEventImpl(
    at java.awt.EventQueue.access$000(
    at java.awt.EventQueue$
    at java.awt.EventQueue$
    at Method)
    at java.awt.EventQueue.dispatchEvent(
    at com.intellij.ide.IdeEventQueue.e(
    at com.intellij.ide.IdeEventQueue._dispatchEvent(
    at com.intellij.ide.IdeEventQueue.b(
    at com.intellij.ide.IdeEventQueue.dispatchEvent(
    at java.awt.EventDispatchThread.pumpOneEventForFilters(
    at java.awt.EventDispatchThread.pumpEventsForFilter(
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(
    at java.awt.EventDispatchThread.pumpEvents(
    at java.awt.EventDispatchThread.pumpEvents(
[  20527]  ERROR - ij.components.ComponentManager - IntelliJ IDEA 11.1.1  Build #IU-117.117
[  20527]  ERROR - ij.components.ComponentManager - JDK: 1.6.0_29
[  20527]  ERROR - ij.components.ComponentManager - VM: Java HotSpot(TM) 64-Bit Server VM
[  20528]  ERROR - ij.components.ComponentManager - Vendor: Sun Microsystems Inc.
[  20528]  ERROR - ij.components.ComponentManager - OS: Windows 7
[  20528]  ERROR - ij.components.ComponentManager - Last Action: NewModuleInGroup

Apparently I have forgotten something?

Kind regards,

1 comment
Comment actions Permalink

Okay, I have found the cause of this issue:
     The Spring plugin that is packaged with the 'Ultimate' version of IntelliJ.

I have just discovered that this issue *only* occurs when the file (that is created by my plugin) is an XML file... and it has a Spring-beans definition in it. Whenever my plugin creates this file, the 'Spring Framework is detected in the project' message appears (so far, I have always ignored this pop-up message during my plugin development). However, as a test, I once configured the Spring plugin for my new module and from then on: when I started/closed the project, the error message never re-appeared. As a final test I have let my plugin create *only* the required folder structure and then I manually created this Spring XML file. The result was as expected: the same error message!

So this looks to me like a bug in the Spring plugin.



Please sign in to leave a comment.