Comments (11)
For the engine deletion, here's my conclusion:
If not, we need to try implementing enter and exit in the bindings. In the post above, there's another answer with more details (https://stackoverflow.com/a/74656071).
Specifically there's a comment:
You might need to put your listener class in a wrapper class.
I think that might be the solution.
So the Engine class in python will bind a new C++ class f3d::engine_wrapper which contains a std::unique_ptrf3d::engine we reset to nullptr in the wrapper destructor AND the exit binding.
And an untested sample:
class engine_wrapper
{
public:
engine_wrapper():mEngine(new engine()) {}
py::object enter() { return py::cast(mEngine.get()); }
void exit(py::handle, py::handle, py::handle) { mEngine = nullptr; }
// forward all functions
f3d::options& getOptions() { return mEngine.getOptions(); }
// ...
private:
std::unique_ptr<f3d::engine> mEngine;
}
py::class_<f3d::engine_wrapper> engine(module, "Engine"); // note usage of engine_wrapper instead of directly the engine
from f3d.
partially addressed by #1005
from f3d.
Overwriting engine / Closing the window manually
Unable to "really" reproduce, the window cannot be closed properly unless the interactor is running. My window manager doesn't let me close the window (Awesome, ArchLinux). Which WM are you using ?
I think it could be considered some kind of force closing. I'm not sure how we can handle it more cleanly but no F3D code is running when you close that window.
from f3d.
Blocking interactor
Reproduced. We need to use threads to fix that. I think we definitely want it.
from f3d.
Crashing interactor
Unable to reproduce, my window manager let me close the window without issue and python is not crashing.
I think your window manager must be quite brutal ^^
from f3d.
No filename when pressing N
Yes, and it makes complete sense. Should be adressed in the context of #443
from f3d.
Engine deletion
Reproduced
from f3d.
I can work on that issue.
from f3d.
Great, let me know if you need any help
from f3d.
Engine Deletion
Code Used To test
import f3d
e = f3d.Engine()
del e
The del statement removes the reference to the object, potentially making it eligible for garbage collection, but it does not mean that the window should be close.
As for my understanding, I may be wrong. Engine holds a reference to itself, so even when we remove our reference to it (the variable “e”) the reference count never falls to 0 because it still has its own internal reference(Python Developer’s Guide, n.d.) .
Additionally, I have tried to delete a tkinter, a python gui tool, window with the del statement and it didn't closed the window.
Code Used to at tkinter
import tkinter
root = tkinter.Tk()
del root
I believe we should define an "Engine" attribute specifically dedicated to the task of closing windows and performing any necessary clean-ups.
Reference:
Python Developer’s Guide. (n.d.). Garbage collector design. [online] Available at: https://devguide.python.org/internals/garbage-collector/index.html [Accessed 17 Jan. 2024].
from f3d.
@Meakk @snoyer I think you investigated a bit this, please follow up with your conclusions.
from f3d.
Related Issues (20)
- More point splats shaders
- CI: Grid related test fails on macos arm64 CI because of a grid artifact
- Obj's with tga textures don't get their textures displayed HOT 4
- UI bug on docs page
- F3D crashes on resizing diagonally on windows HOT 8
- Tone mapping does not work on Android HOT 1
- f3d 2.3.0 tar.gz checksum mismatch HOT 3
- Upon app launch on macOS, key press does not register until user clicks within window HOT 7
- What should the "developer name" be? HOT 2
- [SOLVED] Not a bug - Navigate next/previous file with arrow keys doesn't work properly (has workaround) HOT 4
- Application fails when has to generate thumbnail for certain 3mf file because of a crash on exit HOT 22
- Loading a GeoTIFF DEM (32 bits) file is not working HOT 5
- OpenCascade (OCCT) 7.8.0 not supported HOT 2
- Add C bindings for the libf3d HOT 4
- Add support of Quake 1 MDL files. HOT 10
- Upgrade CI clang-format to > 16
- About how to localize HOT 5
- `--scan-plugins` is undocumented HOT 1
- `BUILD_SHARED_LIBS=OFF` with OCCT plugin on Windows fails to build because of name conflict
- TestF3DBitonicSort fails in `F3D_SANITIZER==adress` in CI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from f3d.