Home » Community » Newbie corner » broken pick semantics
broken pick semantics [message #37817] |
Wed, 14 November 2012 23:23 |
crydev
Messages: 151 Registered: October 2012 Location: Netherlands
|
Experienced Member |
|
|
I'm building a movie managing program. I have a settings dialog that loads data from a global variable which is an instance of a class that manages an XML file. As long as I keep the loading of data inside the constructor of the dialog: there is no problem. When I create a new function that loads the data, for example, to reload the data every time I reopen the dialog I get a "broken pick semantics" error. My code is as following:
ConfigurationStorage MovieManagerConfiguration; // global variable that holds the settings data
void SettingsDialog::Reload()
{
mDirectoryList.Clear();
auto x = MovieManagerConfiguration.SyncDirectories.GetCount(); // this throws the semantics error!
for (int i = 0; i < x; i++)
{
mDirectoryList.Add(MovieManagerConfiguration.SyncDirectories[i]);
}
}
The Vector<String> SyncDirectories contains 1 string variable at that moment. If I put the loop code back inside the dialog constructor the error does not appear. I call the dialog as following:
Inside the constructor of my main window:
mSettingsDialog.WhenSettingsChanged = THISBACK(SettingsChanged);
Inside the open button:
void MovieManager::Options()
{
mSettingsDialog.Reload();
mSettingsDialog.Execute();
}
Why am I getting this error? How can I fix it? Am I maybe doing my settings management the wrong way by using a global class instance like this? I am busy on C++ while always have been doing C# so I will believe it if I am not doing the correct thing here.
|
|
|
Goto Forum:
Current Time: Thu May 09 17:04:28 CEST 2024
Total time taken to generate the page: 0.01487 seconds
|