Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memo generates access violation error #18

Closed
Ariel-MN opened this issue Feb 18, 2022 · 26 comments
Closed

Memo generates access violation error #18

Ariel-MN opened this issue Feb 18, 2022 · 26 comments
Assignees
Labels
bug Something isn't working

Comments

@Ariel-MN
Copy link

The Memo component generates an access violation error after changing the style of the application.

Example code:

import os
from delphivcl import *

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

class MainForm(Form):

    def __init__(self, owner):
        self.Caption = "Test Memo"
        self.SetBounds(10, 10, 500, 400)
        self.Position = "poScreenCenter"

        # Memo component
        self.txtMemo = Memo(self)
        self.txtMemo.SetProps(Parent=self)
        self.txtMemo.SetBounds(10, 40, 300, 100)

        # Auto-load new style
        self.__sm = StyleManager()
        self.__load_style()

    def __load_style(self):
        self.__sm.LoadFromFile(os.path.join(BASE_DIR, "Windows11_Modern_Dark.vsf"))
        self.__sm.SetStyle(self.__sm.StyleNames[1])

def main():
    Application.Initialize()
    Application.Title = "Checking DelphiVCL4Python"
    Main = MainForm(Application)
    Main.Show()
    Application.Run()
    Main.Destroy()

if __name__ == '__main__':
    main()
@lmbelo
Copy link
Member

lmbelo commented Feb 18, 2022

@Ariel-MN thank you to report. I will have a look on it.

@lmbelo lmbelo self-assigned this Feb 18, 2022
@Priyatham10
Copy link
Member

I tested with the same code you sent and found no such error. I even added one more style and printed them to the Memo. Please find the code and the GUI output result image.

import os
from delphivcl import *

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

class MainForm(Form):

    def __init__(self, owner):
        self.Caption = "Test Memo"
        self.SetBounds(10, 10, 500, 400)
        self.Position = "poScreenCenter"

        # Memo component
        self.txtMemo = Memo(self)
        self.txtMemo.SetProps(Parent=self)
        self.txtMemo.SetBounds(10, 40, 300, 100)

        # Auto-load new style
        self.__sm = StyleManager()
        self.__load_style()

        self.txtMemo.Lines.Add(f"Number of loaded styles: {len(self.__sm.StyleNames)}")
        self.txtMemo.Lines.Add("The loaded Styles are:")
        self.txtMemo.Lines.Add(self.__sm.StyleNames[0])
        self.txtMemo.Lines.Add(self.__sm.StyleNames[1])
        self.txtMemo.Lines.Add(self.__sm.StyleNames[2])

    def __load_style(self):
        self.__sm.LoadFromFile(os.path.join(BASE_DIR, "Windows10SlateGray.vsf"))
        self.__sm.LoadFromFile(os.path.join(BASE_DIR, "SapphireKamri.vsf"))
        self.__sm.SetStyle(self.__sm.StyleNames[2])

def main():
    Application.Initialize()
    Application.Title = "Checking DelphiVCL4Python"
    Main = MainForm(Application)
    Main.Show()
    Application.Run()
    Main.Destroy()

if __name__ == '__main__':
    main()

image

The error is because you might not have permission to access the Windows11_Modern_Dark.vsf style file.

@Ariel-MN
Copy link
Author

Ariel-MN commented Feb 19, 2022

I have all users full permission on the style file properties and have no problem using the same style file in an app with other components.

The application runs but it is impossible to interact with it as it generates this error that keeps reappearing in a loop.
err

Im using:

  • Windows 11
  • Python 3.10.2
  • delphivcl 0.1.34

In my environment the error is consistent even using other styles.

@Priyatham10
Copy link
Member

Okay, fine. Thanks for more details. @Ariel-MN you meant that this error is getting generated when using the Memo component only and runs fine with other components? And did you try any other styles with the Memo component to test their working status with the Memo?

@Ariel-MN
Copy link
Author

Absolutely. The error only happens with the Memo component and not with others and I have tried with several styles obtaining the same result.

@Priyatham10
Copy link
Member

Weird! You can see it running without any issue in the reply I posted above right? Maybe, we'll need to simulate your exact environment (OS and python version) and try it once. Will get back with more news as we figure out anything new on this.

Thank you so much and we appreciate you keep trying and testing more.

@lmbelo
Copy link
Member

lmbelo commented Feb 19, 2022

Most likely something regarding the Win 11. Are you using Python x86 or x64?

@Ariel-MN
Copy link
Author

@Priyatham10 You are very welcome. Unfortunately your script produced the same result as mine in both of my environments.
@lmbelo I am using Python x86. I can confirm that it is not related to the version of Windows, I have tried it on another PC and am running into the same issue in this environment:

  • Windows 10
  • Python 3.9.7
  • delphivcl 0.1.34

@lmbelo
Copy link
Member

lmbelo commented Feb 19, 2022

@Ariel-MN I will try to simulate in a similar environment as yours.

@lmbelo
Copy link
Member

lmbelo commented Mar 23, 2022

@Ariel-MN are you still facing such error? I can't reproduce it here.

@Ariel-MN
Copy link
Author

@lmbelo yes, i still have the same problem.

@lmbelo
Copy link
Member

lmbelo commented Mar 24, 2022

@Ariel-MN I really can't reproduce this issue. I have tried in Win 11 and even in Win 10, it's working in both.

@Ariel-MN
Copy link
Author

@lmbelo If it can be useful I can offer you access through teamviewer to one of my environments.

@lmbelo
Copy link
Member

lmbelo commented Mar 24, 2022

@Ariel-MN It would be great.
Please, send an e-mail to lucas.belo@live.com to schedule a date.
Thank you for your interest and support.

@lmbelo
Copy link
Member

lmbelo commented Mar 26, 2022

I was finally able to reproduce this issue under Python x64 architecture. It does run well under Python x86.

@lmbelo
Copy link
Member

lmbelo commented Mar 29, 2022

I realized this is something regarding the new ComCtrls library. It occurs when the SystemStyle is enable, which may happen when using a comctrls32.dll >= 393216.
We have a ticket at https://quality.embarcadero.com/browse/RSP-37835.
I will provide a workaround soon.

@lmbelo lmbelo added bug Something isn't working and removed Can't reproduce labels Mar 29, 2022
@lmbelo
Copy link
Member

lmbelo commented Mar 29, 2022

I have the workaround done. I hope to get it available in our next release.

@Ariel-MN
Copy link
Author

That's very good news. I'll be waiting for the new version. Thank you.

@lmbelo
Copy link
Member

lmbelo commented Apr 8, 2022

@Ariel-MN it was solved in Delphi 11.1, as related in the ticket, then I don't need to proceed with my workaround.
have in mind if you release your own module using Delphi 11 the error will persist.

I'm working on a new release and it will be available soon.

@lmbelo
Copy link
Member

lmbelo commented Apr 12, 2022

A new release is available 🚀

Can you try again, please?

@Ariel-MN
Copy link
Author

Ariel-MN commented Apr 12, 2022

@lmbelo, fixed in version 1.0.39, although this new version seems to have broken compatibility with the new Class TNumberBox added in v. 1.0.38.

@lmbelo
Copy link
Member

lmbelo commented Apr 12, 2022

Thank you to report @Ariel-MN. I will investigate this case.

@lmbelo
Copy link
Member

lmbelo commented Apr 13, 2022

@Ariel-MN a new version containing the TNumberBox fix is out. Can you try again?

@Ariel-MN
Copy link
Author

@lmbelo, now everything works perfectly. Even other High DPI related issues have been fixed with Delphi 11.

@lmbelo
Copy link
Member

lmbelo commented Apr 13, 2022

@lmbelo, now everything works perfectly. Even other High DPI related issues have been fixed with Delphi 11.

Fabulous 🚀

Can we close this issue?

@Ariel-MN
Copy link
Author

Sure, go ahead.

@lmbelo lmbelo closed this as completed Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants