Attached pane window being deleted under me |
Post Reply |
Author | |
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
Posted: 08 March 2010 at 4:32pm |
Hi all. Due to the lack of documentation I can't really find out if this is normal behaviour but I've had an issue appear where the CXTPDockingPaneMiniWnd is deleting the window I have attached to a pane from underneath me.
Here is my setup. - I run my application and create 3 tabbed panes docked together. - Undock them as a group by double clicking title bar. - Pull one off from the other two so I now have two pane windows, one with two tabbed panes in it, and one with one in it. - Double click the single pane title bar, it redocks. - Double click the dual pane title bar, it redocks. - Then I double click AGAIN, the title bar of the docked group and they undock back to a set of two and a single pane. - Double click the single pane title bar to dock it back and BAM! The application dies in my code because it tries to use was window it created that was deleted from underneath it by the last docking operation. Stack trace inside CodeJock:
DestroyWindow() is called which ends up destroying the window inside that pane. Is this normal behaviour? If it is, it means I need to track when my windows are deleted and any code the references those or tracks those needs to be notified. Can someone explain this to me please. Thanks Aaron NOTE: This has happened with 13.2 and 13.3. |
|
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3 Language: Visual C++ 6 |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
Hi;
Could you show me your OnDockingPaneNotify message handler? |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
|
Hi there. I can't give you the whole handler but here's a trimmed down version with some stuff obviously replaced but with all the code handling code there. Let me know if you need more.
Thanks Aaron |
|
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3 Language: Visual C++ 6 |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
on this note, it would be really useful to be able to store an ID with a pane, so we can match things up on loading layouts.
p.p.s this is on 13.3.0 |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
Hi;
am I right when I assume that below code creates the underlying window too? If this is true then you have to check in the Attach section whether the window handle is still valid or not! DashboardPanel *panel = new DashboardPanel(SOME ID);I do it this way:
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
|
mgampi, you're sort of right. In order to match up our internal objects with the correct pane we need to save a mapping between pane id and our objects (Dashboard). When we get a XTP_DPN_SHOWWINDOW message, we look to see if we have a mapping for that pane id already. If we do, we just attach the dashboard window to it. If we don't, then we create a new dashboard (Which does create a window, yes) and then attach that.
I understand what you're saying in that the panel should be checked that it's valid, but unfortunately that's not exactly the problem. When this code is called (During the first time a pane is shown) the panel windows are created fine, and they show up. It's later on, when they are undocked and docked again in some strange manner, that for some reason the CodeJock framework is calling DestroyWindow on it, which inevitably destroys my dashboard window, even though my application doesn't know that it has. From that point on the window handle is invalid. I'm trying to work out if this is normal. Can CodeJock destroy windows that you've created and put into panes, whenever it feels like? If so, then I will need to trap that and have some sort of observer pattern so things can be told when it's destroyed. If not, then is it a bug? Thanks for your help |
|
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3 Language: Visual C++ 6 |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
Hi;
You attach the created window to the docking pane. So it takes control. I just tried your steps and in my case I catch a ShowWindow message in OnDockingPaneNotify. All I have to do is check the window handle of my control and then recreate it if necessary. It works very well. If you require information about the window destroyed, just call an appropriate function in your OnDestroy message handler, but perhaps you could change your dashboard window to a singleton... |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
I think the point is that simply changing the docking of a pane shouldn't call DestroyWindow on it.
Personally I consider this a bug. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |