gtkd-developers / GtkD

GtkD is a D binding and OO wrapper of GTK+ originally created by Antonio Monteiro
http://gtkd.org
Other
322 stars 71 forks source link

Idle thread added with threadsAddIdle thread not exiting on return false on debug build #210

Closed andresclari closed 7 years ago

andresclari commented 7 years ago

Implemented an idle thread using the multithreaded application example, and I was scratching my head as to why the thread wasn't exiting when reaching the:

if (!running) {
    writeln("Exiting idle thread");
    return false;
}

However, that only seems to happen when building as debug, and with DMD only, with LDC it works as expected both for debug and release.

MikeWey commented 7 years ago

For the demo the problem was that the callback had a return type of bool while gdk uses gboolean which is an alias/typedef for int.

I fix this in the demo by changing the return type to int.

https://github.com/gtkd-developers/GtkD/commit/af0b1f9f961a8c256286b3bf6ac47ebc2fa3e5a5

andresclari commented 7 years ago

Confirmed that solves the issue. Worth noting non the less the different behavior with the debug + dmd combination vs LDC.

MikeWey commented 7 years ago

I got the incorrect behavior with both debug dmd and plain dmd, i still have to take a closer look at it. It might be a dmd regression.