runtime crash and also, whidbey support

  • Anonymous - 2004-09-20

    While playing around with win32gui, I found that the following statement would cause a crash sometimes:

    if(find_wnd_range<my_wnd>(null_wnd, search_siblings) == wnd_iterator<wnd>())

    I was finally able to narrow it down to the fact that I didn't have BOOST_HAS_THREADS or BOOST_LWM_WIN32 defined.  In the library, the class sp_counted_base had a member object "mutable mutex_type mtx_", but since neither of those #defines were available to my project, my object was smaller than the library's object.  In boost, BOOST_LWM_WIN32 is defined in the lightweight_mutex.hpp header, which includes lwm_win32_nt.hpp, which is why win32gui is having this particular problem.

    --Also, if you're interested, I found that if you change line 38 in shared_ptr.hpp to
    #define BOOST_MSVC _MSC_VER
    and also add the following block of code to wnd_iterator, win32gui will compile under the most recent publicly available Visual Studio 2005 beta (with lots of compiler warnings for deprecated command-line options, but they're harmless).

    // MOS-  added this block for VC.NET 2005/b1 compatibility
       // note: this next line won't work until operator< (at the very least) is implemented
       //typedef typename array::iterator::iterator_category iterator_category;
       typedef std::bidirectional_iterator_tag iterator_category;
       typedef typename array::iterator::value_type value_type;
       typedef typename array::iterator::difference_type difference_type;
       typedef typename array::iterator::pointer pointer;
       typedef typename array::iterator::reference reference;
    // MOS-  end add block

    I'm really having fun using win32gui, it has made win32 gui programming fun again.  :)  Great job!

    • Anonymous - 2004-09-20

      Er, that first line of code should be wnd_iterator<my_wnd>() of course.

    • John Torjo

      John Torjo - 2004-09-20

      Man, I must have been careless :(

      Many thanks for pointing out both things - they were both bugs!
      I fixed them - and will post an update soon (that is, this week).

      Thanks again!

      As for the last thing (added this block for VC.NET 2005/b1 compatibility). I ran into the same thing when re-porting to gcc/como. So I think I fixed this - could you pls download the latest version (1.4.1b)?


      • Anonymous - 2004-09-20

        Ah yes, I see your change, that's a better way than the way I did it.  I'm still getting a compile error, but it is different from the previous library versions; I just assumed it was the same one.

        Whidbey now refuses to compile win32gui since wnd_iterator doesn't have operator< defined, and random_access_iterator_tag was specified as its category.  --Whidbey does a lot of debug range checking, which is probably why this is coming up for me.  I've solved it for now by simply making wnd_iterator a bidirectional iterator in my build.

        • John Torjo

          John Torjo - 2004-09-20

          Ouch :(
          For operator< - my mistake.

          I'll implement it in the next release ;)



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks