PDA

View Full Version : QPen issues in dll - Using Qt objects across Dll boundary



Preeteesh
1st June 2012, 11:01
Hi, I have a dll which returns QPen and this dll is used by another exe/dll which actually uses this Pen in the paint method. This causes a assertion _BLOCK_TYPE_IS_VALID. This happens bec QPen internally allocates it's d_ptr on heap which when deleted (based upon ref count mech) causes this assertion...

This Debug assertion is telling me; basically, the heap you are trying to return the memory to doesn't know anything about that block ...

Does that means i shouldn't use Qt objects inside a DLL ? If i need to use how should i use across dll boundaries?

Note -> I am using MSVC compiler.

d_stranz
3rd June 2012, 01:57
QtCore, QtGui, and the rest of Qt on Windows are DLLs, right? So if you can't use Qt objects created in a DLL in an EXE, then you wouldn't be able to use Qt at all, would you?

Since you haven't showed us any code, we could guess all day what it is you're doing wrong, and maybe we would guess correctly, but most likely we would be incorrect. So, as Wysota says, show us a minimum compilable example that demonstrates the problem, and we will try to determine what's wrong with it.

ChrisW67
4th June 2012, 01:22
Multiple threads in you program by any chance?