分割类故障(11) [英] Class segmentation fault (11)

查看:476
本文介绍了分割类故障(11)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请按照以下步骤操作:


  1. 创建新的 Firemonkey手机类应用程序

  2. TGeustureManager 组件添加到窗体

  3. 添加2 TButton的组件到表单

  1. Create New Firemonkey Moblie Application
  2. Add TGeustureManager component to the Form
  3. Add 2 TButton components to the Form


  • Button1.Text:Button1的:做些什么......

  • Button2.Text:将Button2:退出应用程序...

在Button2的组件双击并编写以下code为的OnClick 事件:

Double click on Button2 Component and write the following code for OnClick Event:

procedure TForm1.Button2Click(Sender: TObject);
begin
  if MessageDlg('Are you sure you want to Exit?', TMsgDlgType.mtWarning,
          [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0) = mrYes then
    SharedActivity.finish;
end;


  • 运行在调试模式下的应用程序。

  • 在设备上,单击该按钮2,然后单击是弹出的消息。例外会出现:

  • Run the application in debug mode.
  • on the device, click the button 2, then click yes to the popped up message. An exception will appear:

    这是为什么发生异常?

    我认为这是关系到未使用 TGeustureManager 组件。但NO,是

    I thought it is related to unused TGeustureManager component. but NO it is NOT:


    1. 如果您打开自带的德尔福xe5的位置演示项目。

    2. 添加如下图所示 TButton的组件位置标签:

    3. 如上面添加同一code到的OnClick 事件。

    4. 运行应用程序,并单击Button5,你会得到相同的异常。

    1. If you open the Location Demo project that comes with Delphi xe5.
    2. Add TButton component to Location Label as shown in the image below:
    3. Add the same code as above to OnClick Event.
    4. Run the application, and click on Button5, you will get the same exception.

    这是一个错误,我应该举报?还是我做错了什么?

    Is this a bug should I report? or am I doing something wrong?

    推荐答案

    也许你正在杀死运行,其前执行流已经耗尽,从而导致问题的活动。就像在形式方法释放一种形式....

    Possibly that you are killing the activity that is running, before its execution flow has been exhausted, thereby causing problems. Much like freeing a form in a form method....

    如果您更换会发生什么:

    What happens if you replace:

    SharedActivity.finish

    uses
      FMX.Helpers.Android;
    ...
    CallOnUIThread(procedure begin SharedActivity.finish end);
    

    [从内存类型,因此可能需要一些调整]

    [ Typed from memory, so may need some tweaking ]

    这篇关于分割类故障(11)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆