Skip to content

Application crash on macOS after closing the Py-QT5 window. #409

Open
@HawaiAl

Description

@HawaiAl

Hello.
There is a big problem with macOS Ventura 13.1.
I've made the simplest app for macOS 64-bit - one Form, one Button. It executes a very simple python script.

Everything works fine, but after closing the chart window, the application crashes with a message in a PAServer:
objc_disposeClassPair: class 'FMXWindow' still has subclasses, including 'NSKVONotifying_FMXWindow’!

In larger projects, the effect is stranger. What can be done to solve this problem?

P.S. It is also interesting that after running the script, the application icon changes to the Matplotlib icon.

unit MainUnit;
interface
uses
   PythonEngine,
   System.Classes,
   FMX.Forms, FMX.Controls, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Types;

type
   TFormMain = class(TForm)
      ButtonRun: TButton;
      procedure FormCreate(Sender: TObject);
      procedure ButtonRunClick(Sender: TObject);
      private
         py: TPythonEngine;
   end;

var
   FormMain: TFormMain;

implementation
{$R *.fmx}

procedure TFormMain.FormCreate(Sender: TObject);
begin
   // Create python engine
   py                     := TPythonEngine.Create(Self);
   py.UseLastKnownVersion := True;
   py.FatalAbort          := False;
   py.FatalMsgDlg         := False;
   // Load DLL
   py.LoadDll;
end;

procedure TFormMain.ButtonRunClick(Sender: TObject);
begin
   // Simple script, that uses matplotlib and Py-QT5
   var s: ANSIString := 'import matplotlib.pyplot as plt'#10
         + 'plt.plot([1.6, 2.7])'#10
         + 'plt.show()';
   py.ExecString(s);
end;

end.

Activity

pyscripter

pyscripter commented on Feb 3, 2023

@pyscripter
Owner

@lmbelo Any idea what this error message means?

lmbelo

lmbelo commented on Feb 27, 2023

@lmbelo
Contributor

I will try to reproduce it here and reply with further details.

pyscripter

pyscripter commented on Aug 1, 2023

@pyscripter
Owner

@lmbelo Any progress on this one?

lmbelo

lmbelo commented on Aug 2, 2023

@lmbelo
Contributor

@pyscripter I still didn't investigate this case. Checking it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Application crash on macOS after closing the Py-QT5 window. · Issue #409 · pyscripter/python4delphi