Changeset View
Changeset View
Standalone View
Standalone View
src/kioslave/kioslave.cpp
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 117 | MessageBoxA(NULL, | |||
---|---|---|---|---|---|
120 | MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); | 120 | MB_OK | MB_ICONINFORMATION | MB_TASKMODAL); | ||
121 | } | 121 | } | ||
122 | } | 122 | } | ||
123 | # endif | 123 | # endif | ||
124 | #endif // Q_OS_WIN | 124 | #endif // Q_OS_WIN | ||
125 | 125 | | |||
126 | int (*func)(int, char *[]) = (int (*)(int, char *[])) sym; | 126 | int (*func)(int, char *[]) = (int (*)(int, char *[])) sym; | ||
127 | 127 | | |||
128 | exit(func(argc - 1, argv + 1)); /* Launch! */ | 128 | // We need argv[0] to remain /path/to/kioslave | ||
129 | // so that applicationDirPath() is correct on non-Linux (no /proc) | ||||
130 | // and we want to skip argv[1] so the kioslave exe is transparent to kdemain. | ||||
131 | const int newArgc = argc - 1; | ||||
132 | QVarLengthArray<char*, 5> newArgv(newArgc); | ||||
anthonyfieroni: Now has a leak, use vector instead. | |||||
133 | newArgv[0] = argv[0]; | ||||
134 | for (int i = 1; i < newArgc; ++i) { | ||||
135 | newArgv[i] = argv[i+1]; | ||||
136 | } | ||||
137 | | ||||
138 | exit(func(newArgc, newArgv.data())); /* Launch! */ | ||||
129 | } | 139 | } |
Now has a leak, use vector instead.