lmi
[Top][All Lists]
Advanced

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

[lmi] Is this wxXRC change safe?


From: Greg Chicares
Subject: [lmi] Is this wxXRC change safe?
Date: Sat, 24 Feb 2018 02:14:50 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

It seems odd that a wx data member is accessed directly here:

$grep m_parentAsWindow *.?pp
input_sequence_entry.cpp:        (m_parentAsWindow
rounding_view_editor.cpp:        (m_parentAsWindow

when a GetParentAsWindow() const accessor is available (though
the accessor was added in wx-2.9.5, and this code may be older).

Is it safe to apply the patch below? I hesitate only because the
accessor's documentation says:

  
http://docs.wxwidgets.org/3.1/classwx_xml_resource_handler.html#a59e6a94940a4d1c781f83f6396760a5a
| After CreateResource has been called this will return the item's
| parent as a wxWindow.

but the data member is accessed within DoCreateResource() in both
occurrences below, where the accessor's behavior may be unspecified.

---------8<--------8<--------8<--------8<--------8<--------8<--------8<-------
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index 45e8e7076..b449623e5 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -1617,7 +1617,7 @@ wxObject* InputSequenceEntryXmlHandler::DoCreateResource()
     XRC_MAKE_INSTANCE(control, InputSequenceEntry)
 
     control->Create
-        (m_parentAsWindow
+        (GetParentAsWindow()
         ,GetID()
         ,GetName()
         );
diff --git a/rounding_view_editor.cpp b/rounding_view_editor.cpp
index 7eebbcac4..17eeddc54 100644
--- a/rounding_view_editor.cpp
+++ b/rounding_view_editor.cpp
@@ -373,7 +373,7 @@ wxObject* RoundingButtonsXmlHandler::DoCreateResource()
     XRC_MAKE_INSTANCE(control, RoundingButtons)
 
     control->Create
-        (m_parentAsWindow
+        (GetParentAsWindow()
         ,GetID()
         ,GetPosition()
         ,GetSize()
--------->8-------->8-------->8-------->8-------->8-------->8-------->8-------



reply via email to

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