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

#RadialLightFix deconstructor problem along with Access Violations #32

Open
EOSource opened this issue Nov 10, 2021 · 1 comment
Open

Comments

@EOSource
Copy link

EOSource commented Nov 10, 2021

Hello, when i have this enabled with static /mt option compiled with Visual Studio 2019
.lib also compiled with /MT

Randomly sometimes the deconstructor gets called without warning and crashes while trying to draw the radialight

I completely removed the deconstructor and decided to call it manually and its fixed

100% The deconstructor was at fault and being called "Randomly",, this was happening with just a simple radiallight being initalized and drawn like so:

`// create a light source
		candle::RadialLight light;
		light.setRange(150);
		this->lightsources.push_back(light);`

candle::LightingArea fog(candle::LightingArea::FOG,
				sf::Vector2f(0.f, 0.f),
				sf::Vector2f(680, 480.f));
				fog.setAreaColor(sf::Color::Black);
				fog.setAreaOpacity(fogopacity);

				fog.clear();
				for (int i = 0; i < this->lightsources.size(); ++i)
				{
					fog.draw(lightsources[i]);//would randomly deconstruct this and then draw and then crash
				}
				for (int i = 0; i < this->lightsources2.size(); ++i)
				{
					fog.draw(lightsources2[i]);
				}
				fog.display();

				Device->draw(fog);

And here was the modifications i made to fix the error in the Memory Module / .lib
image

SFML Event Closed:
image

Which results in:
image

image

@EOSource EOSource changed the title #RadialLightFix decontructor problem #RadialLightFix deconstructor problem Nov 10, 2021
@EOSource EOSource changed the title #RadialLightFix deconstructor problem #RadialLightFix deconstructor problem along with Access Violations Nov 10, 2021
@MiguelMJ
Copy link
Owner

Mmm this is a though one. I don't know what's causing this random destructor calls... and for some reason I'm not able to reproduce them. I think I need to test it with different compilers to see what's wrong.
I just warn you that if you wanted to add that to a PR I would have to decline it, because although it works for you, it would cause compatibility problems with the existent library. But I'm happy to see that at least you have fixed it for you.
Thank you, @EOSource . I'll report here if some changes are made that might solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants