GithubHelp home page GithubHelp logo

Crash on OSX about pyimgui HOT 6 CLOSED

pyimgui avatar pyimgui commented on August 24, 2024
Crash on OSX

from pyimgui.

Comments (6)

swistakm avatar swistakm commented on August 24, 2024

Yeah, imgui requires proper initialization and careful new_frame() / render() functions handling. We should definitely add some guards to protect from crashes like this one. Anyway, such usage will still raise exceptions. Did you try to run examples from doc/examples? You should take a look at them.

from pyimgui.

jeremyherbert avatar jeremyherbert commented on August 24, 2024

Yep, examples work fine. I was more reporting this because the error message could perhaps be better.

from pyimgui.

swistakm avatar swistakm commented on August 24, 2024

Yeah of course this should be fixed. Your lldb traceback shows already that there is some python assert exception raised from C++ code. This will require updating some function signatures in cython sources.

from pyimgui.

swistakm avatar swistakm commented on August 24, 2024

If we update all Cython signatures as following:

diff --git a/imgui/cimgui.pxd b/imgui/cimgui.pxd
index c2877ff..7ced93c 100644
--- a/imgui/cimgui.pxd
+++ b/imgui/cimgui.pxd
@@ -283,7 +283,7 @@ cdef extern from "imgui.h" namespace "ImGui":

     # ====
     # Window
-    bool Begin(const char*, bool*, ImGuiWindowFlags)  # ✓
+    bool Begin(const char*, bool*, ImGuiWindowFlags) except + # ✓
     # note: following API was deprecated
     # bool Begin(const char*, bool*, const ImVec2&, float, ImGuiWindowFlags)
     void End()  # ✓

Then running functions without Imgui context being properly initialized will result in imgui.core.ImGuiError exception. For instance, the Python traceback for imgui.begin() function can be following:

Traceback (most recent call last):
  File "issue.py", line 4, in <module>
    imgui.new_frame()
  File "imgui\core.pyx", line 993, in imgui.core.new_frame (imgui/core.cpp:15179)
    cimgui.NewFrame()
imgui.core.ImGuiError: ImGui assertion error (g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f) at imgui-cpp/imgui.cpp:2046

@jeremyherbert is such traceback more helpful?

from pyimgui.

swistakm avatar swistakm commented on August 24, 2024

I have the made required changes on fix/full-exception-coverage branch. I need to test it extensively but it should fix this issue.

from pyimgui.

swistakm avatar swistakm commented on August 24, 2024

Fix merged. Now every C++ assert should be treated as imgui exception.

from pyimgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.