Results 1 to 3 of 3

Thread: QPen issues in dll - Using Qt objects across Dll boundary

  1. #1
    Join Date
    Jun 2007
    Posts
    23
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QPen issues in dll - Using Qt objects across Dll boundary

    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.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QPen issues in dll - Using Qt objects across Dll boundary

    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.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QPen issues in dll - Using Qt objects across Dll boundary

    Multiple threads in you program by any chance?

Similar Threads

  1. QgraphicsSimpleTextItem, QPen outline
    By user14921 in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2011, 16:07
  2. Replies: 3
    Last Post: 9th January 2010, 15:47
  3. How to fix the boundary..??
    By deepusrp in forum Qt Programming
    Replies: 18
    Last Post: 17th May 2007, 04:41
  4. Problems with QPen
    By prosass in forum Newbie
    Replies: 3
    Last Post: 13th March 2007, 15:54
  5. Replies: 7
    Last Post: 18th July 2006, 21:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.