Giter VIP home page Giter VIP logo

buglist's Introduction

Hi ~ I’m Hancel Lin. 👋

I am a R&D engineer at BYD. I mainly develop in the technical fields of C++ Windows, Web front-end and crawler.

I love open source. In my spare time, I always write some gadgets and plug-ins. For example, VSCode extension Google Translate, Markdown Image. System gadget KeyGenius, website application Code Snippet, Eng, Invitation Card Maker, etc.

Welcome to experience my open source products. If you have any problems or needs, you can raise them in the issue.

buglist's People

Watchers

 avatar  avatar

buglist's Issues

node-ffi 对 library 回调函数处理的坑的解决

时间:2018/05/02
现象:
通过 node-ffi 创建 callback参数:

let matchCallback = ffi.Callback('void', ['int', 'int'], (vid, pid) => {
    console.log('match device, VID: ', vid, ', PID: ', pid)
});

刚开始一段时间均可正常回调。但将程序静置一段时间后,调用回调函数即刻会引起程序完全崩溃。
问题原因:
静置一段时间后,该回调函数变量被垃圾回收,但没有被置为空或 undefined(大坑啊!)。因此调用时操作了不存在的回调,引起程序崩溃。
解决方案:
添加如下代码

process.on('exit', function() {
    matchCallback;
});

使之在程序结束前仍然保持引用,不会被回收。
参考资料:node-ffi/node-ffi#84

Electron 通过 node-ffi.library加载带数组参数函数,传入参数执行时报错。

时间:2018/04/27
现象:
通过 XCode 编译生成了一个 dylib ,其中包含函数:int device_open(int uVID, int uPID, int uReportID, int ioDevicesIndex[10], long* pnCount)
通过 node-ffi 进行加载,尝试使用 ref 创建 int 指针方式模拟数组。
执行报错。错误提示:TypeError: error setting argument 3 - writePointer: Buffer instance expected as third argument
解决方案:
使用 ref-array 创建数组参数。
参考资料:https://gist.github.com/ryosuzuki/186958bf1abb0492f626

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.