Skip to content

Commit b8fc74a

Browse files
djdrondjdron
andauthored
Crash fix when using multiple renderers (do not use static currentPipe) (#428)
Co-authored-by: djdron <[email protected]>
1 parent fd1d235 commit b8fc74a

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/libprojectM/Renderer/Renderer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <chrono>
1818
#include <ctime>
1919

20-
Pipeline* Renderer::currentPipe;
21-
2220
using namespace std::chrono;
2321

2422
class Preset;
@@ -533,7 +531,11 @@ void Renderer::Interpolation(const Pipeline& pipeline, const PipelineContext& pi
533531
else
534532
{
535533
mesh.Reset();
536-
omptl::transform(mesh.p.begin(), mesh.p.end(), mesh.identity.begin(), mesh.p.begin(), &Renderer::PerPixel);
534+
Pipeline *cp = currentPipe;
535+
omptl::transform(mesh.p.begin(), mesh.p.end(), mesh.identity.begin(), mesh.p.begin(),
536+
[cp](PixelPoint p, PerPixelContext &context) {
537+
return cp->PerPixel(p, context);
538+
});
537539

538540
for (int j = 0; j < mesh.height - 1; j++)
539541
{

src/libprojectM/Renderer/Renderer.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class Renderer
190190
PerPixelMesh mesh;
191191
BeatDetect *beatDetect;
192192
TextureManager *textureManager;
193-
static Pipeline* currentPipe;
193+
Pipeline* currentPipe;
194194
TimeKeeper *timeKeeperFPS;
195195
TimeKeeper *timeKeeperToast;
196196

@@ -252,11 +252,6 @@ class Renderer
252252
void CompositeShaderOutput(const Pipeline &pipeline, const PipelineContext &pipelineContext);
253253
void CompositeOutput(const Pipeline &pipeline, const PipelineContext &pipelineContext);
254254

255-
inline static PixelPoint PerPixel(PixelPoint p, PerPixelContext &context)
256-
{
257-
return currentPipe->PerPixel(p,context);
258-
}
259-
260255
void rescale_per_pixel_matrices();
261256

262257
void draw_toast();

0 commit comments

Comments
 (0)