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

using ImGuiListClipperPtr triggers AccessViolationException after upgrading to 1.89 #401

Closed
pixtur opened this issue May 27, 2023 · 13 comments
Labels

Comments

@pixtur
Copy link

pixtur commented May 27, 2023

Hi,

after upgrading to v1.89.5 the following code causes as System.AccessViolationException:


  unsafe
  {
      var clipperData = new ImGuiListClipper();
      var listClipperPtr = new ImGuiListClipperPtr(&clipperData);
      listClipperPtr.Begin(items.Count, ImGui.GetTextLineHeightWithSpacing());
   }

Maybe I'm using the API in an unintended way, but it I assume something changed in the implementation. This could also be on the ImGui side, but I'm not good enough with C to write an example.

@zaafar
Copy link
Collaborator

zaafar commented May 28, 2023

was it working before 1.89.5?

@pixtur
Copy link
Author

pixtur commented May 28, 2023

after upgrading to 1.89

Good point I only tested 1.88.0 and 1.87.3. v1.88 also triggers the exception. v1.87.3 works.

I know it's kind of too much work to ask for, but these were me steps to reproduce:

  1. clone https://github.com/still-scene/t3/tree/dev
  2. Upgrade nuget package
  3. Start Editor and then open Window -> Console from Tooll's app menu.

@zaafar
Copy link
Collaborator

zaafar commented May 28, 2023

I just tested imgui.net version 1.89.4 (which points to cimgui 1.89.2) and its working fine.
Looks like it broke in the last upgrade (i.e. imgui.net version 1.89.5 which points to cimgui 1.89.5).

i will dig more and try to figure out what changed between these 2 versions that broke it...

@zaafar zaafar added the bug label May 28, 2023
@zaafar
Copy link
Collaborator

zaafar commented May 28, 2023

the only thing that changed was as following.
image

@zaafar
Copy link
Collaborator

zaafar commented May 28, 2023

==debugging+fixing the issue==

-> lets go into this function
image

-> lets go into this function
image

-> lets go into this cimgui (c language) function.
image

-> according to this c++ (imgui function), looks like Ctx isn't initialized and it is suppose to be.
image

@zaafar
Copy link
Collaborator

zaafar commented May 28, 2023

==solution==

i am not sure if this is how we should do it....or if this is the right ctx to use but this is one possible solution.

image

@zaafar
Copy link
Collaborator

zaafar commented May 28, 2023

interesting read: ocornut/imgui@c8ad25c -> ocornut/imgui#5856

@pixtur
Copy link
Author

pixtur commented May 29, 2023

Oh wow. Thanks for looking into that so quickly!
I'm not in a rush to upgrade, so I can wait until there is a final fix.

@zaafar
Copy link
Collaborator

zaafar commented May 29, 2023

the workaround is here (#401 (comment)) if you want to use that while waiting for a final fix.

@TheLostTree
Copy link

#393 (comment)
this should work also

@zaafar
Copy link
Collaborator

zaafar commented Jun 1, 2023

If you do that, you have to call the c++ destructor function as well. Just FYI.

@ocornut
Copy link

ocornut commented Jun 13, 2023

I have also pushed a workaround on dear imgui side:
ocornut/imgui@e95d66f

@zaafar
Copy link
Collaborator

zaafar commented Jun 13, 2023

Closing this issue as it will be fixed automatically once imgui.net is upgraded to the latest (unreleased) version.

@zaafar zaafar closed this as completed Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants