Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ImageDiff: fix memory leak
It turns out you need to be able to receive BMessages in BApplication to
free the areas allocated by BBitmaps.

However, after fixing this, app_server still crashes during WebKit
testsuite.
  • Loading branch information
pulkomandy committed Sep 14, 2019
1 parent a475ba6 commit 0007523
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Tools/ImageDiff/ImageDiff.cpp
Expand Up @@ -42,6 +42,15 @@

#ifdef __HAIKU__
#include <Application.h>

static status_t apprunner(void* data)
{
thread_id mainThread = *(thread_id*)data;
BApplication* app = new BApplication("application/x-vnd.webkit-imagediff");
send_data(mainThread, 0, NULL, 0);
app->Run();
return 0;
}
#endif

using namespace ImageDiff;
Expand All @@ -60,7 +69,10 @@ int main(int argc, const char* argv[])
#endif

#ifdef __HAIKU__
new BApplication("application/x-vnd.webkit-imagediff");
thread_id me = find_thread(NULL);
thread_id appthread = spawn_thread(apprunner, "BApplication thread", B_LOW_PRIORITY, &me);
resume_thread(appthread);
receive_data(&appthread, NULL, 0);
#endif

float tolerance = 0.0f;
Expand Down

0 comments on commit 0007523

Please sign in to comment.