Comments (5)
Don't remove the widget when your are inside the signal handler. This will lead to undefined behaviour. Remember what you have to remove and remove it after your call to HandleEvent() returns.
from sfgui.
Is there an example available that shows how to do this? (Desktop.cpp seems to 'remove' inside the signal handler, unless I'm misunderstanding the terminology?)
from sfgui.
In the case of Desktop.cpp, we first create another shared_ptr to the widget we want to remove, remove it and return from the handler. We also make sure not to try to manipulate the object too much. Once we remove it we must assume it is no longer safe to access. The example was written this way to stay short, and given its simplicity we could also manage the dangers that are associated with this method. We wouldn't recommend doing this in anything more complex than this scenario however.
from sfgui.
Sorry to bother you again, but what do you mean by "Remember what you have to remove and remove it after your call to HandleEvent() returns."?
Does this mean storing the widget to be removed inside of a class or global variable and then deleting it inside of the while (mainWindow.pollEvent(event)) code block?
from sfgui.
Does this mean storing the widget to be removed inside of a class or global variable and then deleting it inside of the while (mainWindow.pollEvent(event)) code block?
Yes.
from sfgui.
Related Issues (20)
- Can't expand ScrolledWindow children
- No obvious way to prevent window dragging. HOT 2
- sfgui apps crash immediately HOT 9
- Errors while batch build HOT 2
- Better integration in modern workflow HOT 4
- Font doesn't render properly HOT 4
- Trying to use with codeblocks HOT 13
- Update include/SFGUI/Config.hpp Version Information HOT 1
- Clipboard support HOT 1
- Undefined reference while trying to static linking with mingw32 HOT 1
- Sample projects crash when run in debug on Windows HOT 4
- Can't build on macOS 10.15 HOT 1
- Global state HOT 4
- Create The Style Reference
- How can I set the size of a widget or of a button? HOT 1
- Examples are miniature on Mac OS (Retina) HOT 2
- Password cursor moves away from current typing point HOT 2
- feature request: color picker
- Naming of engine's source files
- Problem on RenderBatch.hpp could not be found!
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 sfgui.