Jump to content

Blocking method MessageDlg can not be called here


herculanojs

Recommended Posts

Something strange is happening with version 1.10.0.1459, when there is an exception in nested procedures.

The example below is pretty simple, but in complex routines this is causing problems. I did not encounter this problem until the upgrade to this version.

 

 

Example:

procedure test;

begin

         try

            test2;

         except

              raise;

         end;

end;

 

 

procedure teste2;

begin

         try

            test3;

         except

         on e: exception

           begin

                  MessageDlg (e.Message, mtError, [mbOK]);

           end;

         end;

end;

 

procedure test3;

begin

         try

             ... process

         except

         on e: exception

           begin

                  MessageDlg (e.Message, mtError, [mbOK]);

           end;

         end;

end;

Link to comment
Share on other sites

  • Administrators
 

Blocking methods can not be called inside exception blocks. We added this restriction recently. It is done to avoid some unexpected side effects which may lead to application crash.

If you only need to show a message then use non-blocking ShowMessageN() or MessageDlg() with a callback.

...

 

...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...