Em quinta-feira, 20 de abril de 2017, às 02:14:24 PDT, Sze Howe Koh escreveu: > Someone posted the quested at http://stackoverflow.com/ > questions/43487752/when-qt-5-will-fail-the-connect and I'm curious to know > the answer. > > Since the connections are checked at compile-time, does that mean > QObject::connect() is guaranteed to succeed at run-time unless a duplicate > connection is attempted with Qt::UniqueConnection?
No, it's not guaranteed. There's a normal problem and an ABI problem that can intervene. First, remember that you pass the pointer to a signal, but what if the pointer you passed is not a signal? In that case, the connection will fail at runtime. Second, the ABI problem. We've found that PMFs across DLLs/shared libraries don't work very well. Many compilers do not implement them properly and allow for unintended violations of the One Defintion Rule. What happens is that you pass the PMF of a signal, but when the meta object code tries to compare that PMF to itself, the comparison fails and so the connection fails. We have disabled some optimisations that caused these violations and reported bugs to compilers that caused them in other situations. All issues I know of have been fixed, but that doesn't mean that there aren't more to be found. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest