CNewFileSelector example issue

In my own vst plugin, I use CNewFileSelector (part of vstgui) to open a file dialog. If I follow the example code in cfileselector.h which I am copying here, I think there is a big problem.

// Running the file selector
void MyClass::runFileSelector ()
{
	CNewFileSelector* selector = CNewFileSelector::create (getFrame (), CNewFileSelector::kSelectFile);
	if (selector)
	{
		selector->addFileExtension (CFileExtension ("AIFF", "aif", "audio/aiff"));
		selector->setDefaultExtension (CFileExtension ("WAVE", "wav"));
		selector->setTitle("Choose An Audio File");
		selector->run (this);
		selector->forget ();
	}
}

// Getting results
CMessageResult MyClass::notify (CBaseObject* sender, IdStringPtr message)
{
	if (message == CNewFileSelector::kSelectEndMessage)
	{
		CNewFileSelector* sel = dynamic_cast<CNewFileSelector*>(sender);
		if (sel)
		{
			// do anything with the selected files here
			return kMessageNotified;
		}
	}
	return parent::notify (sender, message);
}

The selector->forget () call ends up destroying the selector because the number of reference is 1 (I checked with a debugger). Thus the code then crashes. I think forget() needs to be called in MyClass::notify() instead.

		if (sel)
		{
			// do anything with the selected files here
            sel->forget();
	        return kMessageNotified;
		}

Looking at other instances of usage of this class, it is never used this way, but only with runModal() which I believe is a blocking call, so it makes sense to call forget() right after.

Can you confirm that the example given is incorrect?

I think the example was written before it could run non-modal. The example should be changed to just call runModal instead of run.