removing DeleteFcn of all descendants to prevent infinite loop

1 view (last 30 days)
When trying to close my gui which contains a plot of several graphs, I encountered an error (below). This error repeated continuously (infinite loop of error) and I wanted to know how can I avoid it.
Here is my close request function:
function figure1_CloseRequestFcn(hObject, eventdata, handles)
AllMyTimers = timerfind('Tag', 'myTimers');
if ~isempty(AllMyTimers)
stop( AllMyTimers );
delete(AllMyTimers);
end
delete(hObject); % this is where the crash occures (2688 in figure1_CloseRequestFcn )
------ The error: -----
Warning: Too many objects created while deleting uipanel children; removing DeleteFcn of all descendants to prevent infinite loop.
> In MainGUI>figure1_CloseRequestFcn at 2688
In gui_mainfcn at 96
In MainGUI at 33
In @(hObject,eventdata)MainGUI('figure1_CloseRequestFcn',hObject,eventdata,guidata(hObject))
{Warning: Too many objects created while deleting uipanel children;
removing DeleteFcn of all descendants to prevent infinite loop}
> In MainGUI>figure1_CloseRequestFcn at 2688
In gui_mainfcn at 96
In MainGUI at 33
In @(hObject,eventdata)MainGUI('figure1_CloseRequestFcn',hObject,eventdata,guidata(hObject))
{Warning: Too many objects created while deleting uipanel children;
removing DeleteFcn of all descendants to prevent infinite loop}
...
and so on, infinitely.
  4 Comments
Dhanya
Dhanya on 6 Oct 2017
Hi, Was this problem solved. I too encountered a similar behavior and am looking for ways to solve it.
Jan
Jan on 6 Oct 2017
@Dhanya: This thread could be solved, because Shahar did not show the code (although "I've added my figure1_CloseRequestFcn" seems to imply this). Without seeing the code, how could we suggest an improvement? So please open a new thread and add the details.

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!