Re: [Development] invokeMethod() with function pointers

2017-01-24 Thread Benjamin TERRIER
Hi, I'd like to get this in before 5.9 FF. The current state is: - It works for member functions, function pointers and functors - It soft breaks existing code that were passing null literals. - The new functions do not accepts any arguments, users have to use lambda - The new functions do ac

Re: [Development] invokeMethod() with function pointers

2017-01-21 Thread Grégoire Barbier
Le 21/01/2017 à 00:20, Thiago Macieira a écrit : It's a shift of responsibility. If we had the BlockingAutoConnection (or SynchronousConnection, which is what I wanted to call it during Qt 4.5 when I first proposed it), the deadlock would be Qt's fault. Since it's you doing that, the deadlock bec

Re: [Development] invokeMethod() with function pointers

2017-01-20 Thread Thiago Macieira
On sexta-feira, 20 de janeiro de 2017 17:34:50 PST Grégoire Barbier wrote: > > See the discussion in https://codereview.qt-project.org/83404/ for why > > this is not a good idea. > > In summary, BlockingQueuedConnection is dangerous as it can lead to > > deadlock if the other thread is waiting on y

Re: [Development] invokeMethod() with function pointers

2017-01-20 Thread Gunnar Roth
> > I respect the fact that you rejected Qt::BlockingAutoConnection in 2014 > because of its potential danger, but I'm not sure that it's better to let > people use the "QThread::currentThread() == this" pattern without being > warned rather than implementing Qt::BlockingAutoConnection, with a

Re: [Development] invokeMethod() with function pointers

2017-01-20 Thread Grégoire Barbier
Le 20/01/2017 à 11:14, Olivier Goffart a écrit : On Dienstag, 17. Januar 2017 11:21:56 CET Grégoire Barbier wrote: Le 16/01/2017 à 10:34, Olivier Goffart a écrit : > What's the use case for this function? For direct call you better of > calling the function directly, and the equivalent of Queue

Re: [Development] invokeMethod() with function pointers

2017-01-20 Thread Olivier Goffart
On Dienstag, 17. Januar 2017 11:21:56 CET Grégoire Barbier wrote: > Le 16/01/2017 à 10:34, Olivier Goffart a écrit : > > What's the use case for this function? For direct call you better of > > calling the function directly, and the equivalent of QueuedConnection > > can be achieved with QTimer::s

Re: [Development] invokeMethod() with function pointers

2017-01-20 Thread Olivier Goffart
On Freitag, 20. Januar 2017 09:59:55 CET Benjamin TERRIER wrote: > 2017-01-20 3:01 GMT+01:00 Thiago Macieira : > > we also catch the even more dubious code: > > char func[] = "deleteLater"; > > QMetaObject::invokeMethod(&obj, func); I think we should still support that. > > > > T

Re: [Development] invokeMethod() with function pointers

2017-01-20 Thread Benjamin TERRIER
2017-01-20 3:01 GMT+01:00 Thiago Macieira : > Because it's a template, so the template when Func = char* matches better than > the overload with const char*. I assume that using nullptr without casting > also breaks, correct? Correct. > From what you explained, this will not affect the case when

Re: [Development] invokeMethod() with function pointers

2017-01-19 Thread Thiago Macieira
On quinta-feira, 19 de janeiro de 2017 16:18:30 PST Grégoire Barbier wrote: > > The return value is interesting still. > > With lambdas the return value itself can be replaced with a captured > reference, isn't it ? > Anyway it's still convenient to have it when calling plain old methods > rather

Re: [Development] invokeMethod() with function pointers

2017-01-19 Thread Thiago Macieira
On quinta-feira, 19 de janeiro de 2017 12:24:34 PST Benjamin TERRIER wrote: > template > static typename > QtPrivate::QEnableIf::IsPointerToMemberFun > ction && QtPrivate::FunctionPointer::ArgumentCount == -1 > && !std::is_same::value, bool>::Type > invokeMethod(QObject *object, Func function)

Re: [Development] invokeMethod() with function pointers

2017-01-19 Thread Grégoire Barbier
Le 17/01/2017 à 18:11, Thiago Macieira a écrit : Em terça-feira, 17 de janeiro de 2017, às 11:21:56 PST, Grégoire Barbier escreveu: And maybe lambdas too, if there was a way to choose the thread/eventloop in which we want the lambda to be executed (but christmas was a few weeks ago, I should not

Re: [Development] invokeMethod() with function pointers

2017-01-19 Thread Benjamin TERRIER
Hi, I've got an issue. Adding template static typename QtPrivate::QEnableIf::IsPointerToMemberFunction && QtPrivate::FunctionPointer::ArgumentCount == -1 && !std::is_same::value, bool>::Type invokeMethod(QObject *object, Func function) to QMetaObject breaks existing code and the auto tes

Re: [Development] invokeMethod() with function pointers

2017-01-17 Thread Thiago Macieira
Em terça-feira, 17 de janeiro de 2017, às 11:21:56 PST, Grégoire Barbier escreveu: > And maybe lambdas too, if there was a way to choose the thread/eventloop > in which we want the lambda to be executed (but christmas was a few > weeks ago, I should not dream ;-)). If we do this, it should be pos

Re: [Development] invokeMethod() with function pointers

2017-01-17 Thread Edward Welbourne
Grégoire Barbier: > Kind of Qt::DirectOrBlockingQueuedConnection. Blocking_DirectOrQueued_Connection, surely. Eddy. ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development

Re: [Development] invokeMethod() with function pointers

2017-01-17 Thread Grégoire Barbier
Le 16/01/2017 à 10:34, Olivier Goffart a écrit : What's the use case for this function? For direct call you better of calling the function directly, and the equivalent of QueuedConnection can be achieved with QTimer::singleShot. Hi. AFAIK there is no other way to call a method across threads

Re: [Development] invokeMethod() with function pointers

2017-01-16 Thread Thiago Macieira
On segunda-feira, 16 de janeiro de 2017 19:23:07 PST Benjamin TERRIER wrote: > The QTimer solution could work, but you cannot add parameters without using > std::bind. Use a lambda. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center __

Re: [Development] invokeMethod() with function pointers

2017-01-16 Thread Benjamin TERRIER
2017-01-16 10:34 GMT+01:00 Olivier Goffart : > On Samstag, 14. Januar 2017 17:28:01 CET Benjamin TERRIER wrote: > > Hi everyone, > > > > I'm trying to contribute by making QMetaObject::invokeMethod() take > function > > pointers instead of function names. > > > > I've come up with something that w

Re: [Development] invokeMethod() with function pointers

2017-01-16 Thread Olivier Goffart
On Montag, 16. Januar 2017 12:57:01 CET Konstantin Tokarev wrote: > 16.01.2017, 12:34, "Olivier Goffart" : > > On Samstag, 14. Januar 2017 17:28:01 CET Benjamin TERRIER wrote: > >> Hi everyone, > >> > >> I'm trying to contribute by making QMetaObject::invokeMethod() take > >> function pointers i

Re: [Development] invokeMethod() with function pointers

2017-01-16 Thread Konstantin Tokarev
16.01.2017, 12:34, "Olivier Goffart" : > On Samstag, 14. Januar 2017 17:28:01 CET Benjamin TERRIER wrote: >>  Hi everyone, >> >>  I'm trying to contribute by making QMetaObject::invokeMethod() take function >>  pointers instead of function names. >> >>  I've come up with something that works by l

Re: [Development] invokeMethod() with function pointers

2017-01-16 Thread Olivier Goffart
On Samstag, 14. Januar 2017 17:28:01 CET Benjamin TERRIER wrote: > Hi everyone, > > I'm trying to contribute by making QMetaObject::invokeMethod() take function > pointers instead of function names. > > I've come up with something that works by looking at the code of > QMetaObject::invokeMethod,

Re: [Development] invokeMethod() with function pointers

2017-01-14 Thread Konstantin Tokarev
14.01.2017, 20:42, "Thiago Macieira" : > On sábado, 14 de janeiro de 2017 17:28:01 PST Benjamin TERRIER wrote: >>  I've uploaded my change as a draft on gerrit: >>  https://codereview.qt-project.org/#/c/182339/ > > No one can see it while it's a draft. You have to publish the change. Correction:

Re: [Development] invokeMethod() with function pointers

2017-01-14 Thread Benjamin TERRIER
2017-01-14 18:42 GMT+01:00 Thiago Macieira : > > No one can see it while it's a draft. You have to publish the change. > > Ok, it's done. ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development

Re: [Development] invokeMethod() with function pointers

2017-01-14 Thread Thiago Macieira
On sábado, 14 de janeiro de 2017 17:28:01 PST Benjamin TERRIER wrote: > I've uploaded my change as a draft on gerrit: > https://codereview.qt-project.org/#/c/182339/ No one can see it while it's a draft. You have to publish the change. -- Thiago Macieira - thiago.macieira (AT) intel.com Softwa

[Development] invokeMethod() with function pointers

2017-01-14 Thread Benjamin TERRIER
Hi everyone, I'm trying to contribute by making QMetaObject::invokeMethod() take function pointers instead of function names. I've come up with something that works by looking at the code of QMetaObject::invokeMethod, QObject::connect and QMetaObject::activate. However it does not check for para