| Summary: | Use of uninitialized variable in os_custom.cpp (wpf) | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Niels Thykier <niels> |
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse.felipe |
| Version: | 4.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Make that "Here env is only initialized if JNI_VERSION_1_2is defined and IS_JNI_1_2 is a truth value". :) ~Niels Read the entire method, if env == NULL it gets initialized by jvm->AttachCurrentThread((void **)&env, NULL); (maybe the cppcheck tool is failing to detected that ?) The code looks okay to me. Closing this as invalid (note also that we are no longer working on the WPF port). Thank you. |
Build Identifier: Hi cppcheck (1.44) reports a number of possible usage of uninitialized variables in org.eclipse.swt/Eclipse SWT PI/wpf/library/os_custom.cpp. [os_custom.cpp:176]: (error) Uninitialized variable: env [os_custom.cpp:228]: (error) Uninitialized variable: env [os_custom.cpp:289]: (error) Uninitialized variable: env [os_custom.cpp:322]: (error) Uninitialized variable: env [os_custom.cpp:373]: (error) Uninitialized variable: env [os_custom.cpp:469]: (error) Uninitialized variable: env [os_custom.cpp:774]: (error) Uninitialized variable: env [os_custom.cpp:836]: (error) Uninitialized variable: env [os_custom.cpp:865]: (error) Uninitialized variable: env [os_custom.cpp:998]: (error) Uninitialized variable: env It is triggered by code like this: ... JNIEnv* env; ... #ifdef JNI_VERSION_1_2 if (IS_JNI_1_2) { jvm->GetEnv((void **)&env, JNI_VERSION_1_2); } #endif if (env == NULL) { ... Here env is only initialized if JNI_VERSION_1_2 is defined. I have a feeling that this is usually the case, still I thought I would mention it. Note: I have not manually verified all of them. ~Niels Reproducible: Always