Why do I get 'Invalid superclass name' in WebControllerFactory when I attempt to create blank uifigure()?

7 views (last 30 days)
The following error triggers about 100 times when I try to create a uifigure() in Matlab 2021b.
MathWorks::System::IUserException in WebControllerFactory::create(): [Error using matlab.ui.internal.componentframework.WebControllerFactory/checkPreconditions (line 45)
Invalid superclass name.
Error in matlab.ui.internal.componentframework.WebControllerFactory/create (line 92)
checkPreconditions( obj, component, parentController, nargin );]
Warning: Internal error creating figure controller.
Background:
I have code that modifies the DefaultFigureCreateFcn to keep track of when figures are created and destroyed. However, the above error will spam my command window at the beginning of a Matlab session when I attempt to execute my code. It only happens once per Matlab session. In order to reproduce it, I have to restart Matlab and run my code again. Running my code a second time during the same Matlab session does not reproduce the error.
Code Example:
set(0,'DefaultFigureCreateFcn','addlistener(gcf,''ObjectBeingDestroyed'',@(varargin) disp(1));')
hfig = uifigure()
Executing the above code during a fresh Matlab session will trigger the error about 100 times. If I rerun the code during the same session the error no longer occurs.
Any thoughts on why this is occurring? I did a little debugging and from what I can tell, the web controller is receiving a number of objects associated with a toolbar that are not of class web controller or component controller.

Answers (0)

Categories

Find more on Develop uifigure-Based Apps in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!