mirror of
https://github.com/alibaba/GCanvas.git
synced 2025-12-08 17:36:42 +00:00
fix: image binding object finalize crash
This commit is contained in:
parent
a27471a828
commit
8a6cff6f0e
@ -108,12 +108,18 @@ void ImageWorker::setOnLoadCallback(Napi::Function func)
|
||||
|
||||
void ImageWorker::OnOK()
|
||||
{
|
||||
this->onLoadCallback.Call({Env().Undefined()});
|
||||
if( this->onLoadCallback )
|
||||
{
|
||||
this->onLoadCallback.Call({Env().Undefined()});
|
||||
}
|
||||
}
|
||||
|
||||
void ImageWorker::OnError(const Napi::Error &e)
|
||||
{
|
||||
this->onErrorCallback.Call({Napi::String::New(Env(), e.Message())});
|
||||
if(this->onErrorCallback)
|
||||
{
|
||||
this->onErrorCallback.Call({Napi::String::New(Env(), e.Message())});
|
||||
}
|
||||
}
|
||||
|
||||
void ImageWorker::Execute()
|
||||
|
||||
@ -38,11 +38,6 @@ class Image : public Napi::ObjectWrap<Image>
|
||||
public:
|
||||
Image(const Napi::CallbackInfo &info);
|
||||
static void Init(Napi::Env env, Napi::Object exports);
|
||||
virtual ~Image()
|
||||
{
|
||||
delete (mWorker);
|
||||
this->mWorker = nullptr;
|
||||
}
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
std::vector<unsigned char> &getPixels();
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
"scripts": {
|
||||
"install": "./script/install.sh $local",
|
||||
"dev": "cmake-js build",
|
||||
"debug": "cmake-js -D build",
|
||||
"compile": "cmake-js compile --CDCORE_DIR=./core/",
|
||||
"prestart": "export DISPLAY=:99.0 && Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &",
|
||||
"test": "cp ./third_party/font/wqy-microhei.ttc ./ && cp ./third_party/font/.fontcache ./ && node ./examples/$case && rm wqy-microhei.ttc .fontcache",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user