Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-107545

Taking a second future from QPromise overwrites the first one

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.2.9, 6.5.1, 6.6.0
    • 6.4.0
    • Core: QtConcurrent
    • None
    • Linux Mint 21
    • Linux/X11
    • 3
    • 502a7706b (dev), 2e1025dd4 (6.5), c27f4e36d (tqtc/lts-6.2)
    • Foundation Sprint 77, Foundation Sprint 78

    Description

      I'm not 100% if this is a bug as the documentation is a bit unclear, but in the following example I expected to get both callbacks instead of only the second one. If this is intended behavior, perhaps the second then() should print a warning that it is overwriting the old one.

       

      	QPromise<int> p;
      
      	QFuture<int> f1 = p.future();
      	f1.then([](int i) { printf("first\n"); });
      
      	QFuture<int> f2 = p.future();
      	f2.then([](int i) { printf("second\n"); });
      
      	p.start();
      	p.addResult(5);
      	p.finish();
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ivan.solovev Ivan Solovev
            tomba Tomi Valkeinen
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews