Results 1 to 10 of 10

Thread: windows code troubling Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: windows code troubling Qt

    What about those copies? Do you create only one object of CWAB class?

    Quote Originally Posted by munna View Post
    This is the culprit
    if(m_hinstWAB)
    FreeLibrary(m_hinstWAB);
    It's more a workaround, than a solution, but maybe you should load it before you create QApplication and free it after QApplication::exec() returns? Or maybe you should try to load it using QLibrary?

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    10
    Thanked 80 Times in 74 Posts

    Default Re: windows code troubling Qt

    Quote Originally Posted by jacek View Post
    What about those copies? Do you create only one object of CWAB class?
    Yes I create only one object and its deleted once the window is closed.

    Quote Originally Posted by jacek View Post
    maybe you should load it before you create QApplication and free it after QApplication::exec() returns?
    But I don't need it through out the application. Only when user needs to access the Windows Address Book, I need to load the library. And once user is done, I free it.

    Quote Originally Posted by jacek View Post
    Or maybe you should try to load it using QLibrary?
    ok, will try that. But what will happen if I do not call FreeLibrary(m_hinstWAB); ?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: windows code troubling Qt

    Quote Originally Posted by munna View Post
    But what will happen if I do not call FreeLibrary(m_hinstWAB); ?
    Nothing, if everything is implemented well. In worst case windows will think that this library is used by a non-existent process. Of course if you will create more than one CWAB object, you'll get a resource leak.

    Maybe you should try to reproduce that problem using a sample application? That crash might have more than one cause.

  4. #4
    Join Date
    Jan 2006
    Posts
    667
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    10
    Thanked 80 Times in 74 Posts

    Default Re: windows code troubling Qt

    Quote Originally Posted by jacek
    Maybe you should try to reproduce that problem using a sample application?
    hmm, I am not sure what do you mean by that. I have a windows only code which accesses the windows address book and it works perfectly. I integrated that code with Qt code and it crashes the application

    Quote Originally Posted by jacek
    That crash might have more than one cause.
    When I comment those two lines, the app works perfectly (no crashes). But when I uncomment those lines, it crashes in the same place.

    May be I am missing something.

    Thanks a lot!

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: windows code troubling Qt

    Quote Originally Posted by munna View Post
    hmm, I am not sure what do you mean by that. I have a windows only code which accesses the windows address book and it works perfectly. I integrated that code with Qt code and it crashes the application
    So far we know that Qt + FreeLibrary() == crash. The question is: which part of Qt clashes with FreeLibrary().

Similar Threads

  1. C code linux to windows
    By deekayt in forum General Discussion
    Replies: 1
    Last Post: 19th October 2006, 22:17
  2. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  3. Replies: 5
    Last Post: 15th March 2006, 07:33
  4. Mac Port of Windows code
    By Nemo in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2006, 07:37

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
  •  
Qt is a trademark of The Qt Company.