Error "H must be the handle to a figure or figure descendent" on deployed code but not on host machine.

2 visualizzazioni (ultimi 30 giorni)
Hello!
I have a gui program that works on my machine (64 bit) and compiled for a client's machine (also 64 bit). The client also has a 32 bit machine, and I used MATLAB 32 bit to compile the code.
The program goes without a hitch on my machine as well as the client's 64 bit machine, but on the 32 bit machine it goes along just fine until at one point it hangs up. When the client exits (through a close and exit), the error message appears, with line 42. In the gui, that's part of the initialization code, which I didn't edit.
It hangs up when doing some rather intense calculations.
So:
  • Is the error really not at line 42? And where is it then?
  • Can I find out what is going on, on the client's machine?
  • Why would it work on these other machines and not on the 32 bit one?
Thanks
Doug
For refresher:
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @tvm3out4_OpeningFcn, ...
'gui_OutputFcn', @tvm3out4_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:}); %%%%%%THIS IS LINE 42
end
% End initialization code - DO NOT EDIT
  2 Commenti
Geoff Hayes
Geoff Hayes il 16 Ott 2014
Doug - line 42 is probably correct; it is just given as the "starting" point of where the GUI begins its execution. For example, suppose I launch a GUI and put a breakpoint in the callback of a toggle button. I then press that button, and the debugger pauses at the line with the breakpoint. Then in the Command Window, I type
dbstack
I observe
In MyApp>uitoggletoolPlay_ClickedCallback at 96
In gui_mainfcn at 95
In MyApp at 42
In @(hObject,eventdata)MyApp('uitoggletoolPlay_ClickedCallback',
hObject,eventdata,guidata(hObject))
which is the line numbers and file names of the function calls that led to the current breakpoint, listed in the order in which they were executed. Unfortunately, that doesn't help you at all in terms of determining what is causing the crash.
You say that the app crashes when the client exits (through a code and exit) of the GUI. Do you have code that captures this event? i.e. something in the CloseRequestFcn or DeleteFcn functions of your GUI? You mentioned that the GUI is doing some intense calculations at this point. What does that mean - do you have some timers going, FFTs, etc.? If you have some timers, then do you stop them gracefully during the close or just ignore them?
Douglas Anderson
Douglas Anderson il 16 Ott 2014
Hi Geoff,
The app crashes after beginning to do the calculations, which is a bunch of ffts and convolutions (about 15000) on a 1000 point file. It only gets part of the way through. The error message appears when the client presses the close function.
What is weird is that it works fine on my machine AND on a 64 bit machine of the client, but not on a 32 bit machine. So I am puzzled as to how to track this or what may be going on.
By the way, this is what I have (I know it isn't neat!) to close things when done:
% --- Executes on button press in save_and_close_button.
function save_and_close_button_Callback(hObject, eventdata, handles)
% hObject handle to close_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get the current position of the GUI from the handles structure to pass to
% the modal dialog
pos_size = get(handles.figure1,'Position');
% Call modaldlg with the argument 'Position'
user_response = modaldlg('Title','Confirm Close');
switch user_response
case {'No'}
% Take no action
case {'Yes'}
% Prepare to close GUI application window
% .
% handles.output = handles.h_dly;
%guidata(hObject,handles);
if exist('handles.summary_handle')
%close(handles.summary_handle);
delete(handles.summary_handle);
end
if exist('handles.give_me_a_table_handle')
delete(handles.give_me_a_table_handle);
%close(handles.give_me_a_table_handle)
end
uiresume(handles.figure1);
% .
% delete(handles.figure1)
end
% --- Executes during object deletion, before destroying properties.
function save_and_close_button_DeleteFcn(hObject, eventdata, handles)
% hObject handle to save_and_close_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject,handles);

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by