Bug 384176

Summary: QObject: Cannot create children for a parent that is in a different thread.
Product: [Plasma] Breeze Reporter: wolthera <griffinvalley>
Component: QStyleAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Status: RESOLVED FIXED    
Severity: minor CC: halla, hugo.pereira.da.costa, uhhadd
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description wolthera 2017-08-30 13:53:37 UTC
Keep getting 

"(Parent is Breeze::WidgetStateEngine(0x11acb90), parent's thread is QThread(0xe04a70), current thread is QThread(0x1cb56110)
QObject: Cannot create children for a parent that is in a different thread.
"

On every window refresh with KDE Neon, on any kde application that is run via the terminal.

OS Information
  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.10.0-33-generic
  Pretty Productname: KDE neon User Edition 5.10
  Product Type: neon
  Product Version: 16.04

I mostly am noticing it because I am a Krita developer and this is making it very difficult to find Krita debug messages.
Comment 1 Hugo Pereira Da Costa 2017-08-30 13:56:11 UTC
Hi
Thanks for the report.
Indeed this should really not happen. Do you see this with every application, or only with krita ? 
What is your QT version ?
Comment 2 Hugo Pereira Da Costa 2017-08-30 13:57:24 UTC
(In reply to Hugo Pereira Da Costa from comment #1)
> Hi
> Thanks for the report.
> Indeed this should really not happen. Do you see this with every
> application, or only with krita ? 
Ditch that. You already answered.
I cannot reproduce (I use latest Breeze, but a somewhat old Qt, namely 5.7.1)

> What is your QT version ?
Comment 3 Hugo Pereira Da Costa 2017-08-30 14:04:37 UTC
looking at the code it seems that for this to happen you would need the same Widget style object to be used in different threads. 
I have no clue how to adress that, then ...
Comment 4 wolthera 2017-08-30 15:03:34 UTC
I get it as well when plasma dies and I start it up manually in the terminal.

My Qt version is 5.9.1, I also double checked if it happened with Fusion, and it doesn't.

I honestly don't know enough about qtstyles to add anything more meaningful.
Comment 5 Hugo Pereira Da Costa 2017-08-30 15:50:12 UTC
(In reply to wolthera from comment #4)
> I get it as well when plasma dies and I start it up manually in the terminal.
> 
> My Qt version is 5.9.1, I also double checked if it happened with Fusion,
> and it doesn't.

Yep. I would not expect to. The fact that it does not happen with fusion is because it does not try to create objects.

Should happen with oxygen too, and possibly QtCurve. 

The way around this would be to change the way the said object are created, kept track of and deleted. 

(note: they are needed to make these nice animations in breeze, on mouse-over, focus change, etc.)

But that would require careful testing, and first with reproducing the issue.

I'll start with updating Qt and testing. Will keep you posted. Sorry for the trouble
Comment 6 Halla Rempt 2017-10-13 07:35:31 UTC
Any progress here? I'm getting this all the time as well, now that I've moved on from using my own Qt 5.6.
Comment 7 Halla Rempt 2017-10-13 08:12:37 UTC
Hm... We probably also should debug this inside Krita, because it only happens in master, not in 3.3.
Comment 8 Hugo Pereira Da Costa 2017-10-13 08:20:47 UTC
(In reply to Boudewijn Rempt from comment #7)
> Hm... We probably also should debug this inside Krita, because it only
> happens in master, not in 3.3.

Hi Boud,
I'm compiling Qt 5.9 as we speak to try reproduce.
My impression is that the warning is (among other things) a side effect of using QtQuickControls. 
Did you by any chance introduce some in Krita in recent versions ? If yes that would explain.

Hugo
Comment 9 Halla Rempt 2017-10-13 09:05:46 UTC
Hm... Yes, we started using Qt Quick, but not QtQuickControls, afaik, but... Wolthera's report was from before that!
Comment 10 Hugo Pereira Da Costa 2017-10-13 15:28:45 UTC
So
Compiled Qt 5.9 (5.9.3)
Compiled breeze from master.
Modified QT_PLUGIN_PATH to get the proper breeze, 
ran Krita (version 3.2.1), and I cannot reproduce.
Nor can I reproduce with dolphin, gwenview, kate ...

@wolthera can you confirm that you see the error with other applications than krita, and if yes, which one ?
Comment 11 wolthera 2017-10-14 14:24:26 UTC
No, I cannot see it happening in any other qt programs. I tried tiled, because I thought it may have something to do with qt's opengl painter, but even there it went fine.
Comment 12 Janet Blackquill 2022-02-16 16:09:48 UTC
Appears to have been fixed since this was reported; please re-open if you still encounter this error.