Windows bug when dragging elements (and possible fix) #259

Closed
rugruth opened this Issue Dec 1, 2016 · 6 comments

Projects

None yet

2 participants

@rugruth
rugruth commented Dec 1, 2016

Hello all,

I managed to compile latest version of wxFormBuilder following main page instructions under MSYS2. All worked pretty well (with some caveats not very hard to solve), but I've found a bug when I drag an item on the object tree.

Assuming the following initial state:

Image and video hosting by TinyPic

After dragging bSizer3 into bSizer1 I got the following error:

Image and video hosting by TinyPic

And bSizer3 is lost (same occurs whith other types of elements).

After peeking a bit on the source code and a bit of debug, I think the problem is related with asynchornous notification from appdata to object tree, that causes delete event be processed after the item has been pasted on destination. This affects three methods, NotifyObjectSelected(), NotifyObjectCreated() and NotifyObjectRemoved().

Changing the notify method to not delayed solves the issue for me. The git diff follows:

diff --git a/src/rad/appdata.cpp b/src/rad/appdata.cpp
index 160dae9..42d5bf8 100644
--- a/src/rad/appdata.cpp
+++ b/src/rad/appdata.cpp
@@ -2774,19 +2774,19 @@ void ApplicationData::NotifyObjectSelected( PObjectBase obj, bool force )
 	wxFBObjectEvent event( wxEVT_FB_OBJECT_SELECTED, obj );
 	if( force ) event.SetString( wxT("force") );
 
-	NotifyEvent( event, true );
+	NotifyEvent( event, false );
 }
 
 void ApplicationData::NotifyObjectCreated( PObjectBase obj )
 {
 	wxFBObjectEvent event( wxEVT_FB_OBJECT_CREATED, obj );
-	NotifyEvent( event, true );
+	NotifyEvent( event, false );
 }
 
 void ApplicationData::NotifyObjectRemoved( PObjectBase obj )
 {
 	wxFBObjectEvent event( wxEVT_FB_OBJECT_REMOVED, obj );
-	NotifyEvent( event, true );
+	NotifyEvent( event, false );
 }
 
 void ApplicationData::NotifyPropertyModified( PProperty prop )

I hope this helps someone.

Regards,

R.

@jhasse
Member
jhasse commented Dec 13, 2016

Thanks for reporting and especially for the fix :) I can reproduce it.

Passing true to NotfiyEvent was done in 09ce975, do you have any idea why?

@jhasse
Member
jhasse commented Dec 13, 2016

Okay passing true was done in order to fix https://sourceforge.net/p/wxformbuilder/bugs/165/. And applying your fix re-introduces this old bug :/

@rugruth
rugruth commented Dec 14, 2016 edited

Mhhh.... I'm trying to reproduce the bug you linked, using a build with my proposed fix applied and I can't...

If I create some buttons, then change name of one of them, then click on another one (before or after applying pressing enter or clicking on another property, doesn't matter) and program doesn't crash.. I did try clicking on the designer window or in the object tree, same result.

Maybe the underlying problem was fixed with another commit?

Regards.

R

@jhasse jhasse added this to the 3.6.1 milestone Dec 14, 2016
@jhasse
Member
jhasse commented Jan 16, 2017

I don't think so, because I was using the latest master version to test.

Are you using an English version of Windows by any chance?

@rugruth
rugruth commented Jan 16, 2017

No, I'm not using english Windows atm. i'm using Windows 8.1 Enterprise x64, Spanish Locale.

But I can change the OS language and do the test again if that matters.

Regards,

R.

@jhasse
Member
jhasse commented Jan 16, 2017

No need, I'm also using a non-english version (German).

I think I'll apply your fix anyway as this bug is more important than the other one.

@jhasse jhasse removed the Windows label Feb 8, 2017
@jhasse jhasse closed this in 2064198 Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment