lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] wx-2.9.2: "bug in wxDatePickerCtrl: m_date not in sync"


From: Vadim Zeitlin
Subject: Re: [lmi] wx-2.9.2: "bug in wxDatePickerCtrl: m_date not in sync"
Date: Mon, 20 Jun 2011 00:47:37 +0200

On Wed, 15 Jun 2011 21:41:21 +0000 Greg Chicares <address@hidden> wrote:

GC> I've built this tarball:
GC>   ftp://ftp.wxwidgets.org/pub/Daily_HEAD/files/wx-all-2010-11-06.tar.gz
GC> and compiled the 'skeleton' trunk (using HEAD, modified a few minutes ago):
GC>   http://svn.savannah.nongnu.org/viewvc/skeleton/?root=lmi
GC> Now when I run
GC>   /opt/lmi/skeleton/bin[0]$./skeleton.exe --unit_test
GC> the diagnostic messagebox copied below appears; I select "No", and the
GC> program crashes.
[...snipped everything except for the message box itself...]
GC> ---------------------------
GC> wxWidgets Debug Alert
GC> ---------------------------
GC> ../src/msw/datectrl.cpp(218): assert "m_date.IsValid() == dt.IsValid() && 
(!dt.IsValid() || dt == m_date)" failed in GetValue(): bug in wxDatePickerCtrl: 
m_date not in sync
GC> Do you want to stop the program?
GC> You can also choose [Cancel] to suppress further warnings.
GC> ---------------------------
GC> Yes   No   Cancel
GC> ---------------------------

 As you suspected, this was indeed a bug in wxWidgets, thanks for reporting
it! I've committed a simple fix (basically just a "return" was missing in a
condition) for it as r67990 (http://trac.wxwidgets.org/changeset/67990)
together with a unit test verifying that it doesn't get broken again.

 I also had to apply the following patch to the test itself to make it
pass:

diff --git a/mvc_test.cpp b/mvc_test.cpp
index 02312ce..47890cf 100644
--- a/mvc_test.cpp
+++ b/mvc_test.cpp
@@ -744,20 +744,12 @@ void MvcTest::TestReflect()
     LMI_FOCUS(birthdate);
     birthdate.SetValue(ConvertDateToWx(calendar_date(ymd_t(19560114))));
     LMI_YIELD(2, "Try to set birthdate to 19560114, one day past the upper 
limit.");
-#if wxCHECK_VERSION(2,8,0) // wx version 2.8.0 or greater.
-    LMI_TRY_TO_LOSE_FOCUS(false);
-#else  // wx prior to version 2.8.0 .
     LMI_TRY_TO_LOSE_FOCUS(true);
-#endif // wx prior to version 2.8.0 .
     LMI_ASSERT(calendar_date(ymd_t(19560113)) == as_of_date.GetValue());
     LMI_ASSERT( 0 == age.GetValue());
     LMI_ASSERT( 0 == age_minimum.GetValue());
     LMI_ASSERT(99 == age_maximum.GetValue());
-#if wxCHECK_VERSION(2,8,0) // wx version 2.8.0 or greater.
-    LMI_ASSERT(calendar_date(ymd_t(19560114)) == birthdate.GetValue());
-#else  // wx prior to version 2.8.0 .
     LMI_ASSERT(calendar_date(ymd_t(19560112)) == birthdate.GetValue());
-#endif // wx prior to version 2.8.0 .

     // Set birthdate to the latest possible date.

@@ -921,13 +913,8 @@ void MvcTest::TestReflect()
     LMI_FOCUS(as_of_date);
     as_of_date.SetValue(ConvertDateToWx(calendar_date(ymd_t(15821004))));
     LMI_YIELD(2, "Try to set as-of date to a value earlier than the lower 
limit.");
-#if wxCHECK_VERSION(2,8,0) // wx version 2.8.0 or greater.
-    LMI_TRY_TO_LOSE_FOCUS(false);
-    LMI_ASSERT(calendar_date(ymd_t(15821004)) == as_of_date.GetValue());
-#else  // wx prior to version 2.8.0 .
     LMI_TRY_TO_LOSE_FOCUS(true);
     LMI_ASSERT(calendar_date(ymd_t(20010101)) == as_of_date.GetValue());
-#endif // wx prior to version 2.8.0 .
     LMI_ASSERT(90 == age.GetValue());
     LMI_ASSERT(10 == age_minimum.GetValue());
     LMI_ASSERT(90 == age_maximum.GetValue());

As this just removes the workarounds for this wxWidgets bug, I'm reasonably
sure that the changes are correct but it would break the test with 2.9
versions up to today, of course, so it should be only applied when you
update to 2.9.2 or to a snapshot from tomorrow or later.

 In any case, with these changes the test passes correctly for me. I notice
that it still exits with 127 code but I'm not sure whether this indicates
a real problem.

 Thanks again for reporting this bug,
VZ

reply via email to

[Prev in Thread] Current Thread [Next in Thread]