Author Archives: csslayer

当你 Debug 一门过气语言生成的代码里面产生的 memory leak 时会发生什么 (a.k.a. 不要修改 vala 返回的 strv 的 length)

(会被写成 blog 发出来。) 直接上一段代码。 var array = elements.to_array (); array.length = -1; return “(” + string.joinv (” “, array) + “)”; 提问,这段代码有什么问题? 它会生成这样的代码。 _tmp32_ = gee_collection_to_array ((GeeCollection*) _tmp30_, &_tmp31_); array = _tmp32_; array_length1 = _tmp31_; _array_size_ = array_length1; array_length1 = … Continue reading

Posted in Linux | Tagged , | 1 Comment

最近踩的一个关于 std::unique_ptr 的小坑。

简单来说就是这样一件事,std::unique_ptr 在析构途中调用了 .get() 会发生什么这样一个问题。 当然,你是不应该写出这样的代码的……但是有时候这样的行为可能并不是非常明显。所以就会导致问题… 一个 FreeBSD 上的人汇报了在 Linux 上没有的 crash。估计是 libc++ 和 libstdc++ 的行为差别。一个在析构途中就返回 null 了,一个还是返回原始的指针。 总之,小心避免写出这样的代码吧。

Posted in Linux | Tagged , | Leave a comment

Road to Fcitx 5: 4. Compatibility for different im modules.

I have been always care about the compatibility. Fcitx 5 will be able to type with either fcitx 4’s im module, or fcitx 5’s im module. Fcitx 5’s im module will announce itself to accept both “fcitx5” and “fcitx”. Even … Continue reading

Posted in fcitx development | Tagged , | Leave a comment

A case study: how to compile a Fcitx platforminputcontext plugin for a proprietary software that uses Qt 5

Due to the fact, that Qt 5 does not support XIM, the only way to type with fcitx under Qt is to use platforminputcontext plugin. The problem is that for some proprietary software like mathematica, it is impossible to use … Continue reading

Posted in fcitx development | Tagged , , | 1 Comment

The Road to Fcitx 5: 3. You can (NOT) type on wayland (properly).

With a few recent changes on Fcitx 5, Fcitx can now be used to type on Wayland. (Even the window is rendered with EGL! .. ok this is not important) And as of today, I’d say it is the first and … Continue reading

Posted in fcitx development | Tagged , , , , , | Leave a comment