Commit 1d597d5f by Adeel

Importer: Fixes issue with casting.

parent 800738a4
#include<iostream>
#include <nan.h>
#include "sass_context_wrapper.h"
......@@ -19,7 +20,7 @@ void dispatched_async_uv_callback(uv_async_t *req){
TryCatch try_catch;
Handle<Value> argv[] = {
NanNew<String>(ctx_w->file)
NanNew<String>(strdup(ctx_w->file))
};
Local<Value> returned_value = NanNew<Value>(ctx_w->importer_callback->Call(1, argv));
......@@ -67,13 +68,12 @@ struct Sass_Import** sass_importer(const char* file, void* cookie)
{
sass_context_wrapper* ctx_w = static_cast<sass_context_wrapper*>(cookie);
uv_mutex_t t;
ctx_w->importer_mutex->lock();
//uv_mutex_lock(ctx_w->mutex);
// Enter critical section
ctx_w->file = file;
ctx_w->async.data = (void*)&ctx_w;
ctx_w->file = strdup(file);
ctx_w->async.data = (void*)ctx_w;
uv_async_send(&ctx_w->async);
// Reassurances
......
......@@ -24,7 +24,7 @@ extern "C" {
sass_context_wrapper* sass_make_context_wrapper() {
// (sass_context_wrapper*) calloc(1, sizeof(sass_context_wrapper));
auto ctx_w = (sass_context_wrapper*) calloc(1, sizeof(sass_context_wrapper));
ctx_w->importer_mutex = new std::recursive_mutex();
ctx_w->importer_mutex = new std::mutex();
return ctx_w;
}
......
......@@ -17,7 +17,7 @@ struct sass_context_wrapper {
Sass_File_Context* fctx;
Persistent<Object> stats;
uv_work_t request;
std::recursive_mutex* importer_mutex;
std::mutex* importer_mutex;
//uv_mutex_t* mutex;
uv_async_t async;
const char* file;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment